letter-grade.c: Change scanf usage to fgets

This commit is contained in:
BBaoVanC 2020-10-21 20:20:52 -05:00
parent b45e3670cc
commit 1bd69ff2e4
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A

View File

@ -1,9 +1,13 @@
#include <stdio.h>
#include <stdlib.h>
int main() {
int input;
scanf("%i", &input);
printf("Your input was: %i\n", input);
char inputText[4];
fgets(inputText, 4, stdin);
printf("inputText: %s\n", inputText);
long int input;
input = strtol(inputText, NULL, 0);
printf("input: %i\n", input);
if ((input >= 0) && (input <= 100)) {
char letter;
@ -35,4 +39,4 @@ int main() {
}
return 0;
}
}