본문 바로가기
C/c언어 수업

p245 switch

by sj0020 2020. 8. 5.
#include <stdio.h>

int main(void)
{
	int num;
	printf("enter int num btwn 1 to 3: ");
	scanf("%d",&num);

	switch (num)
	{
	case 1:
		printf("A1 ");
		printf("A2 ");
	case 2:
		printf("B1 ");
		printf("B1 ");
	case 3:
		printf("C1 ");
		printf("C1 ");
	default:
		printf("Default \n");
	}
	return 0;

}

'C > c언어 수업' 카테고리의 다른 글

p269 while  (0) 2020.08.05
p255 goto  (0) 2020.08.05
p242 삼항연산자 int - positive/negative/absolute value  (0) 2020.08.05
p.223 scanf 입력받을때 , / - | 이용해 데이터 구분  (0) 2020.08.05
p217 | / - 사용해 데이터 구분  (0) 2020.08.05