Can we use modulus operator ( % ) with float valu..? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Can we use modulus operator ( % ) with float valu..?

Modulus operator used with float valu

21st Jul 2019, 4:34 PM
Pankaj Kumar Maurya
Pankaj Kumar Maurya - avatar
5 Answers
21st Jul 2019, 4:46 PM
Dwi Novianto Nugroho
Dwi Novianto Nugroho - avatar
+ 2
En java % es el resto de una división, es decir que si divides valores enteros esta devolverá un valor entero y si usas valores flot devolverá valores float. In java % is the rest of a division, meaning that if you divide integer values ​​it will return an integer value and if you use flot values ​​it will return float values.
22nd Jul 2019, 12:51 PM
William Rodríguez
William Rodríguez - avatar
+ 2
you can use in java. the result is the remainder.
3rd Aug 2019, 6:46 AM
Sai Ram
+ 2
No we just can't use %for float type
7th Aug 2019, 11:55 AM
ashok kumar
ashok kumar - avatar
+ 2
No we can't able to use %(modulus operators),it lead to compiler run time error. modulus operators can only be by the integer values
7th Aug 2019, 1:50 PM
Nithish Nithish
Nithish Nithish - avatar