Notice
Recent Posts
Recent Comments
Link
«   2025/09   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Tags
more
Archives
Today
Total
관리 메뉴

이것저것

C언어 swea 2072 홀수만 더하기 본문

Language/C언어

C언어 swea 2072 홀수만 더하기

olivia-com 2020. 11. 20. 09:59

https://swexpertacademy.com/main/identity/anonymous/loginPage.do

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

#include <stdio.h>

int main(void)
{
	int arr[10];
	int i, sum = 0;
	
	for(i=0;i<10;i++){
		scanf("%d",&arr[i]);
		if (arr[i] % 2 == 1){ //홀수일 경우 sum에 계속 더하기 
			sum += arr[i];
		}
	}
	printf("%d",sum);
	return 0;
}