38 lines
824 B
C
38 lines
824 B
C
#include <stdio.h>
|
|
|
|
int main() {
|
|
int input;
|
|
scanf("%i", &input);
|
|
printf("Your input was: %i\n", input);
|
|
|
|
if ((input >= 0) && (input <= 100)) {
|
|
char letter;
|
|
int inputRange = input/10;
|
|
|
|
switch(inputRange) {
|
|
case 10:
|
|
case 9:
|
|
letter = 'A';
|
|
break;
|
|
case 8:
|
|
letter = 'B';
|
|
break;
|
|
case 7:
|
|
letter = 'C';
|
|
break;
|
|
case 6:
|
|
letter = 'D';
|
|
break;
|
|
case 5:
|
|
default:
|
|
letter = 'F';
|
|
}
|
|
|
|
printf("Your letter grade is %c\n", letter);
|
|
} else {
|
|
printf("ERROR: Input must be no more than 100 and no less than 0\n");
|
|
return 1;
|
|
}
|
|
|
|
return 0;
|
|
} |