0
Can we use modulus operator with float data type ?
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
+ 2
It depends on the language. In Python you can.
+ 1
I haven't tried it myself, but I found this:
https://stackoverflow.com/questions/7500128/how-to-use-operator-for-float-values-in-c
+ 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.
0
I am talking about c language