+ 2
Data types in java
How to print double value up to 2 decimal places in Java?
6 odpowiedzi
+ 3
//try this
double d = 3.141592;
System.out.println(String.format("%.2f",d));
+ 3
You can use string formatting Or with printf
+ 2
Priyanka Sooranagi
Here is another generic logic to do this.
https://code.sololearn.com/cDLSw0EDAUaM/?ref=app
+ 1
Thank you
+ 1
Thank you
0
Okay thank you