+ 3
Can i use modulus operator with long double variable in c language??
7 odpowiedzi
+ 4
the % operator is for integers.
you can use the inbuilt fmodl function to find the modulus of two floating-point numbers:
https://en.cppreference.com/w/c/numeric/math/fmod
+ 3
Well, you can use double with the help of fmod() function from <cmath>
Example:-
#include <cmath>
#include <iostream>
int main()
{
double a = 8.2;
double b = 2.0;
double c = std::fmod(a, b);
std::cout << c << std::endl;
system("pause");
return 0;
}
+ 1
7
+ 1
Hey guys
0
+1