Can I use a float variable as operand of %? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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 Réponses
+ 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