C언어
[C언어] 시험 등급
c0rinne
2022. 2. 17. 17:00
#include <stdio.h>
main()
{
int i, k;
char c1, c2;
printf("insert integer(0 ~ 100) : ");
scanf("%d", &i);
switch (k = i / 5) {
case 20 :
case 19 : c1 = 'A', c2 = '+'; break;
case 18 : c1 = 'A', c2 = '0'; break;
case 17 : c1 = 'B', c2 = '+'; break;
case 16 : c1 = 'B', c2 = '0'; break;
case 15 : c1 = 'C', c2 = '+'; break;
case 14 : c1 = 'C', c2 = '0'; break;
case 13 : c1 = 'D', c2 = '+'; break;
case 12 : c1 = 'D', c2 = '0'; break;
default : c1 = 'F';
}
printf("점수 = %d 등급 = %c%c\n", i, c1, c2);
}
|
cs |