AlphaCodingSkills is a online learning portal that provides tutorials on Python, Java, C++, C, C#, PHP, R, Ruby, Rust, Scala, Swift, Perl, SQL, Data Structures and Algorithms. Tutorials, examples, references and content of the website are reviewed and simplified continuously to improve comprehensibility and eliminate any possible error. We use cookies to ensure best browsing experience on our website. While using this website, you acknowledge to have read and accepted our cookie and privacy policy., In general, for two numbers a and b, there is. Let's write a toy function: Update: Instead of using floor(a / b) to get quotient, we can also use a %/% b. I'll offer another explanation. Take this problem: Instead of evaluating the modulo, start with simple divison: As you know, the answer "2" means that it takes two sets of 10 to get 20., The modulo operator (%% in R) returns the remainder of the division of 2 numbers. Here are some examples: 5 %% 2 returns 1, because 2 goes into 5 two times and the remainder is 1 (i.e. 5 = 2 × 2 + 1). 4 %% 2 returns 0, since 4 = 2 × 2 + 0. 4 %% 1 returns 0, since 4 = 4 × 1 + 0. 2 %% 4 returns 2, since 2 = 0 × 4 + 2..