+ 2

Data types in java

How to print double value up to 2 decimal places in Java?

23rd Sep 2021, 7:16 AM
Priyanka Sooranagi
Priyanka Sooranagi - avatar
6 odpowiedzi
+ 3
//try this double d = 3.141592; System.out.println(String.format("%.2f",d));
23rd Sep 2021, 7:59 AM
Simba
Simba - avatar
+ 3
You can use string formatting Or with printf
23rd Sep 2021, 9:26 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
23rd Sep 2021, 3:18 PM
A͢J
A͢J - avatar
+ 1
Thank you
23rd Sep 2021, 8:00 AM
Priyanka Sooranagi
Priyanka Sooranagi - avatar
+ 1
Thank you
23rd Sep 2021, 3:22 PM
Priyanka Sooranagi
Priyanka Sooranagi - avatar
0
Okay thank you
23rd Sep 2021, 10:22 AM
Priyanka Sooranagi
Priyanka Sooranagi - avatar