본문 바로가기
JAVA/Coding Test Study

[D1] SWEA - 2072. 홀수만 더하기 : Java

by ♡˖GYURI˖♡ 2023. 11. 18.
728x90
import java.util.Scanner;
import java.io.FileInputStream;

class Solution
{
	public static void main(String args[]) throws Exception
	{
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		for(int i = 1; i <= T; i++) {
		    int sum = 0;
		    for(int j = 0; j < 10;  j++) {
		        int num = sc.nextInt();
		        if(num%2 == 1) sum += num;
		    }
		    System.out.println("#" + i + " " + sum);
		}
	}
}