#include <stdio.h>
int main() {
/* if - else if - else문
if (조건1) {
실행할 코드1;
} else if (조건2) {
실행할 코드2;
} else if (조건3) {
실행할 코드3;
} else {
위의 조건이 모두 거짓일 때 실행할 코드;
} */
int score = 50;
if (score >= 90) {
printf("A\n");
} else if (score >= 80) {
printf("B\n");
} else if (score >= 70) {
printf("C\n");
} else {
printf("F\n");
}
printf("----문제----\n");
int age = 5;
if (age >= 8 && age <= 13) {
printf("초등학생");
} else if (age >= 14 && age <= 16) {
printf("중학생");
} else if (age >= 17 && age <= 19) {
printf("고등학생");
} else if (age >= 20) {
printf("성인");
}
printf("\n");
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: