+ 3

When I want to perform modulus division on two double numbers, it gives error. Please help.

Error while performing modulus division on two double numbers.

1st Dec 2017, 12:26 PM
®️ahul Mathews™️
®️ahul Mathews™️ - avatar
6 Answers
+ 4
// let's say you want to divide i by j with modulus double i = 12.57; double j = 3.14; // create a new value that will store modulus result double k = i; while (k > j) { k -= j; } // after 4 iterations, k = 0.01 printf("%g", k);
1st Dec 2017, 3:44 PM
Eligijus Silkartas
Eligijus Silkartas - avatar
+ 10
In C, modulus division should be performed on integers.
1st Dec 2017, 12:41 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 1
@Krishna Then what is the solution
1st Dec 2017, 1:17 PM
®️ahul Mathews™️
®️ahul Mathews™️ - avatar
+ 1
The result of using a modulus operator is the remainder. In a double number, the remainder is after the decimal point. That's why you can't use the modulus operator on doubles. It's already there.
1st Dec 2017, 11:53 PM
Zeke Williams
Zeke Williams - avatar
- 2
hey friend i have a god idea for México if u want to know and make maney with that send me a msg djonny319@gmail.com
2nd Dec 2017, 6:06 PM
Christian Fiesco
Christian Fiesco - avatar