平均数

输入3个整数,输出它们的平均值,保留3位小数。

import java.util.Scanner;
public class Main {
    public static void main(String[]argc){
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        double sum=(a+b+c)/3.0;
        System.out.println(String.format("%.3f",sum));
    }
}

 

posted @ 2021-11-13 17:44  xuxianglu  阅读(29)  评论(0)    收藏  举报