Algorithm/SW Expert Academy

2071. 평균값 구하기

히욤이 2019. 1. 11. 01:05

SW Expert 1933. 2071. 평균값 구하기

문제의 저작권은 SW Expert에 있습니다 



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import java.util.Scanner;
 
class Solution {
    public static void main(String args[]) {
 
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();
        for (int test_case = 1; test_case <= T; test_case++) {
            int n = 0;
            double sum = 0;
            for (int i = 0; i < 10; i++) {
                n = scanner.nextInt();
                sum =sum+n;
            }
            double avg =Math.round(sum/10);
            
            System.out.println("#" + (test_case)+ " " + (int)avg);
        }
    }
}
cs