+ 2

Can I use a float variable as operand of %?

Can I do that? Because I saw in a exam with a question "What is the output?"

2nd Nov 2017, 8:49 PM
Yusuf
Yusuf - avatar
2 Answers
+ 5
No. % is only for int types. You would need to use fmod()
2nd Nov 2017, 10:09 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
Ok thanks.
3rd Nov 2017, 7:05 AM
Yusuf
Yusuf - avatar