+ 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