Answer the question
In order to leave comments, you need to log in
How to check if you entered a letter in C?
There is a program that asks for 3 numbers, it is in a loop. And how can I make the program display the inscription "ERROR" when a letter is entered?
Answer the question
In order to leave comments, you need to log in
You read each number into a string, in a loop you check each character and if the check passes, then translate the drain into a number.
while(*p) {
if(!isdigit(*p++)) {
isd=false;
break;
}
}
if(isd)
digit=atoi(str);
else
printf("\nERROR\n");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question