返回列表 發帖
  1. import java.text.DecimalFormat;
  2. import java.util.Scanner;

  3. public class JPA01 {
  4.     public static void main(String args[]){
  5.     System.out.println("Please input:");
  6.     Scanner scanner = new Scanner(System.in);
  7.     float x = scanner.nextInt();
  8.     float y = scanner.nextInt();
  9.     float z = scanner.nextInt();
  10.     float Average = (x+y+z)/3;
  11.     DecimalFormat df = new DecimalFormat("#.##");
  12.     String AVG = df.format(Average);
  13.     System.out.print("Average:"+AVG);
  14.         }
  15. }
複製代碼

TOP

返回列表