“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.