0

How to write a program on calculating remainder without using modulus operators?

You can only use multiplication, division and subtraction for these.

10th Dec 2017, 2:35 AM
Sadikul Alim Toki
Sadikul Alim Toki - avatar
4 Réponses
+ 4
@Gordie, because I'm no good in Math : D
10th Dec 2017, 6:48 AM
Ipang
+ 3
int num = 10; int divisor = 3; while(num != 0) { if(num < divisor) break; num -= divisor; } Console.WriteLine(num);
10th Dec 2017, 3:57 AM
Ipang
10th Dec 2017, 4:29 AM
Dima Makieiev
Dima Makieiev - avatar
+ 1
@Gordie, cause we only can add or subtract, multiplication is way above our limit :)
10th Dec 2017, 6:41 AM
Dima Makieiev
Dima Makieiev - avatar