본문 바로가기
C

switch odd/even num

by sj0020 2020. 7. 31.
#include <stdio.h>
void main(void){
	int num1 = 0;

	printf("enter num:");
	scanf("%d", &num1);

	switch (num1) {
	case 1 :
		printf("odd");
		break;
	
	case 2 :
		printf("even");
		break;
	
	case 3:
		printf("odd");
		break;

	case 4:
		printf("even");
		break;
	
	case 5:
		printf("odd");
		break;

	case 6:
		printf("even");
		break;

	case 7:
		printf("odd");
		break;

	case 8:
		printf("even");
		break;

	case 9:
		printf("odd");
		break;
		
	case 10:
		printf("even");
		break;
	
	default :
		printf("!!");
	}
}