언어/C언어

[C언어] 3일차 -4 if / 중첩 if문

antoroong 2025. 2. 9. 21:37

중첩 if문

if와 else if와 else if 등등

 

 

#include <stdio.h>

int main(void) {

int test_if_result4 = testIf_4();

	return 0;
}

int testIf_4() {

	printf("----------- testIf_4 종료 -----------\n\n");
	int a;

	printf("정수를 입력해주세요 : ");
	scanf("%d", &a);

	if (a >= 90) {
		printf("A학점");
	}else if(a >= 80) {
		printf("B학점");
	}
	else if (a >= 70) {
		printf("C학점");
	}
	else {
		printf("F학점");
	}

	return 0;
	printf("----------- testIf_4 종료 -----------\n\n");
}