Answers for "java add 5 numbers and print as float to 2 decimal"

7

print up to 2 decimal in java

System.out.printf("%.2f", value);
Posted by: Guest on November-05-2020
0

print float number with only four places after the decimal point in java

import java.text.DecimalFormat;
public class code{
  public static void main(String[] args){
		double area= 12.21564315;
       	DecimalFormat df = new DecimalFormat("0.0000");
       	System.out.println("A="+df.format(area));
  }
}
Posted by: Guest on March-07-2022

Code answers related to "java add 5 numbers and print as float to 2 decimal"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language