letter-grade.c: Change scanf usage to fgets
This commit is contained in:
parent
b45e3670cc
commit
1bd69ff2e4
@ -1,9 +1,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
int input;
|
char inputText[4];
|
||||||
scanf("%i", &input);
|
fgets(inputText, 4, stdin);
|
||||||
printf("Your input was: %i\n", input);
|
printf("inputText: %s\n", inputText);
|
||||||
|
long int input;
|
||||||
|
input = strtol(inputText, NULL, 0);
|
||||||
|
printf("input: %i\n", input);
|
||||||
|
|
||||||
if ((input >= 0) && (input <= 100)) {
|
if ((input >= 0) && (input <= 100)) {
|
||||||
char letter;
|
char letter;
|
||||||
|
Loading…
Reference in New Issue
Block a user