알고리즘(종합)/Lv.1

2072 - 홀수만 더하기

ch.0 2022. 11. 10. 17:37


10개의 숫자중 홀수만 더하라.

 

입력
3
3 17 1 39 8 41 2 32 99 2
22 8 5 123 7 2 63 7 3 46

6 63 2 3 58 76 21 33 8 1   
출력
#1 200
#2 208
#3 121

 

class Solution
{
public static void main(String args[]) throws Exception
{

//System.setIn(new FileInputStream("res/input.txt"));

Scanner sc = new Scanner(System.in);
int T;
T=sc.nextInt();

int count=0;
for(int test_case = 1; test_case <= T; test_case++)
{count++;
	int sum=0;
	for(int i=0; i<10; i++) {
		int a = sc.nextInt();
		if(a%2!=0) {
		sum+=a;	
		}
	}
	System.out.println("#"+count+" "+sum);


}
}
}