From bd022c5f223b3adf929b0ba10efd3182871f15ed Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Tue, 20 Oct 2020 19:30:51 -0500 Subject: [PATCH] Add letter-grade.c --- letter-grade.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 letter-grade.c diff --git a/letter-grade.c b/letter-grade.c new file mode 100644 index 0000000..f05ffbc --- /dev/null +++ b/letter-grade.c @@ -0,0 +1,23 @@ +#include + +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; +} \ No newline at end of file