How can I get the remainder Without using the modulo? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I get the remainder Without using the modulo?

How can I reverse the number without using modulo example: enter number: 123 the reverse is: 321 PLEASE I NEED IT THANKS IN ADVANCE

22nd Feb 2018, 5:17 AM
Kolokoy97
Kolokoy97 - avatar
6 Answers
+ 2
Maybe by converting it to a string, reversing it and converting it back to int ? Also, you can use this formula for the remainder. Dividend = Divisor*Quotient + Remainder.
22nd Feb 2018, 5:20 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
Remainder = Dividend - Divisor*Quotient. Use this formula. You can get the Quotient by flooring the result of (Dividend/Divisor).
22nd Feb 2018, 5:24 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 1
whats the logic behind the modulo?
22nd Feb 2018, 5:21 AM
Kolokoy97
Kolokoy97 - avatar
+ 1
The formula I posted above, it seems.
22nd Feb 2018, 5:22 AM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 1
how can I get the remainder without using the modulo???
22nd Feb 2018, 5:22 AM
Kolokoy97
Kolokoy97 - avatar
+ 1
thankyou so much Kinshuk! 👏👏👏
22nd Feb 2018, 5:24 AM
Kolokoy97
Kolokoy97 - avatar