System.out.println(decimal);
DecimalFormat df=new DecimalFormat("0.00");
df.setRoundingMode(RoundingMode.DOWN);
System.out.println(df.format(sum));
-----------------------------------------------------------
#1007
----------------------------------------------------------
Scanner scanner=new Scanner(System.in);
System.out.println("请输入一个华氏温度值:");
float htem=scanner.nextFloat();
float h2stem;
h2stem=5*(htem-32)/9;
DecimalFormat format=new DecimalFormat("0.00");
//format.setRoundingMode(RoundingMode.DOWN);
System.out.println(format.format(h2stem));
-----------------------------------------------------------
#1008
----------------------------------------------------------
Scanner scanner=new Scanner(System.in);
System.out.println("请输入圆的半径 r:");
float r=scanner.nextFloat();
评论0
最新资源