“9 is special magic number in case of finding remainder.”
Because if you want to find remainder of any number when divided by 9, just add the digits and keep on adding digits till we get a single digit. It will return the rem.
If returns 9, it means rem is 0.
Number is 123456789/9 find rem. So add digit, its n(n+1)/2 = (9*10)/2 = 45
Since obtained digit is not a single digit, so again sum the digit that obtained in previous step.
So, again sum of digit = 4+5 = 9 So rem is 0.
1112223334/9 find rem. Sum, 1+1+1+2+2+2+3+3+3+4 = 22 Again sum 2+2 = 4 So remainder is 4
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Quotient Remainder Theorem
- Find the smallest number whose digits multiply to a given number n
- Build Lowest Number by Removing n digits from a given number
- Given a number, find the next smallest palindrome
- Find next greater number with same set of digits
- Number of possible Superkeys in DBMS
- Mathematics | Total number of possible functions
- Relationship between number of nodes and height of binary tree
- Number of possible Equivalence Relations on a finite set
- Number of Boolean functions
- Number of possible Functions
- Check if a number is Prime, Semi-Prime or Composite for very large numbers
- Given an array A and a number x, check for pair in A with sum as x
- Find the missing number in Arithmetic Progression
- Root to leaf path sum equal to a given number
- Find the smallest positive number missing from an unsorted array | Set 1
- Find number of pairs (x, y) in an array such that x^y > y^x
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.