How to get quotient with decimals | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

How to get quotient with decimals

In Java: System.out.println(31/7); gives me "4" Assigning it to a double variable first makes no sense either. double x = 31/7; System.out.println(x); gives me "4.0" However the correct answer should be 4.42 How can I make it output 4.42?

4th Mar 2020, 8:19 AM
„Āč„āď„Āß„āď
„Āč„āď„Āß„āď - avatar
1 Respuesta