103計算平均值

/******
檔名:JPA01.java
題目:TQC+ JAVA6物件導向程式設計 參考答案
時間:2015/06
作者:fang shi mai
******/
import java.util.Scanner;

public class JPA01
{
    public static void main(String arvg[])
    {
        Scanner sc=new Scanner(System.in);
        int N1,N2,N3;
        System.out.println("Please input:");
        N1=sc.nextInt();
        N2=sc.nextInt();
        N3=sc.nextInt();
        
        System.out.printf("Average: %.2f",(N1+N2+N3)/3.0);
    }
}

沒有留言:

張貼留言