Add letter-grade.c
This commit is contained in:
parent
e776910e71
commit
bd022c5f22
23
letter-grade.c
Normal file
23
letter-grade.c
Normal file
@ -0,0 +1,23 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int input;
|
||||
scanf("%i", &input);
|
||||
printf("Your input was: %i\n", input);
|
||||
|
||||
char letter;
|
||||
if ((input/10) >= 9) {
|
||||
letter = 'A';
|
||||
} else if ((input/10) >= 8) {
|
||||
letter = 'B';
|
||||
} else if ((input/10) >= 7) {
|
||||
letter = 'C';
|
||||
} else if ((input/10) >= 6) {
|
||||
letter = 'D';
|
||||
} else {
|
||||
letter = 'F';
|
||||
}
|
||||
|
||||
printf("Your letter grade is %c\n", letter);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user