+ 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.
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);
+ 10
In C, modulus division should be performed on integers.
+ 1
@Krishna Then what is the solution
+ 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.
- 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