返回列表 發帖
  1. import java.text.DecimalFormat;
  2. import java.util.Scanner;
  3. public class JPA01 {
  4.         public static void main (String args[]){
  5.         Scanner scanner =new Scanner(System.in);       
  6.                 System.out.println("Please input");
  7.                 int x =scanner.nextInt();
  8.                 int y =scanner.nextInt();
  9.                 int z =scanner.nextInt();
  10.                 float total = (float)(x+y+z)/3;
  11.                
  12.                 DecimalFormat df =new DecimalFormat("#.##");
  13.                 String t = df.format(total);
  14.                 System.out.println("Average:"+total);
  15.         }
  16. }
複製代碼

TOP

返回列表