[정올] Language Coder_배열1_형성평가3_code152 (C)

두비니

·

2020. 4. 15. 13:44

 

 

 

#include <stdio.h>

int main() {

	int n, arr[10], sum = 0, sum2 = 0;

	for (int i = 0; i < 10; i++) {
		scanf("%d", &arr[i]);
		if (i % 2 == 0)
			sum += arr[i];
		else
			sum2 += arr[i];
	}

	printf("odd : %d\n", sum);
	printf("even : %d", sum2);



	return 0;
}