+ 3

Can i use modulus operator with long double variable in c language??

6th Jul 2019, 3:28 PM
Gaurav Rawat
Gaurav Rawat - avatar
7 ответов
+ 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
6th Jul 2019, 3:40 PM
MO ELomari
MO ELomari - avatar
+ 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; }
8th Jul 2019, 3:21 PM
Franky BrainBox
Franky BrainBox - avatar
+ 1
7
13th Jul 2019, 3:15 AM
Anton Nazarov
Anton Nazarov - avatar
+ 1
Hey guys
19th Jul 2019, 3:01 PM
Tensing 007
Tensing 007 - avatar
0
+1
2nd Aug 2019, 12:14 PM
Divanshu Trivedi
Divanshu Trivedi - avatar