Can we use modulus operator with float data type ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can we use modulus operator with float data type ?

2nd Dec 2018, 2:16 PM
Suraj yadav
Suraj yadav - avatar
5 Answers
+ 5
"I am talking about c language" NO, YOU CAN'T! Even simpler than talking, you can make a code for it to see what's happening. Easy as cake, right?! 8D
2nd Dec 2018, 2:32 PM
Babak
Babak - avatar
+ 2
It depends on the language. In Python you can.
2nd Dec 2018, 2:30 PM
HonFu
HonFu - avatar
2nd Dec 2018, 2:32 PM
HonFu
HonFu - avatar
+ 1
Theres no modulus operator for floats, but you can use std::fmod() from the <cmath> header instead. https://en.cppreference.com/w/cpp/numeric/math/fmod Or fmod from <math.h> if you’re using C.
2nd Dec 2018, 2:33 PM
aklex
aklex - avatar
0
I am talking about c language
2nd Dec 2018, 2:31 PM
Suraj yadav
Suraj yadav - avatar