I have a simple problem:
Here is the code:
#include<stdio.h> main(){ int input; printf("Choose a numeric value"); scanf("%d",&input); }
I want the user to enter only numbers ... Therefore, it should be something like this:
#include<stdio.h> main(){ int input; printf("Choose a numeric value"); do{ scanf("%d",&input); }while(input!= 'something'); }
My problem is that I do not know what to replace with "something" ... How can I prevent users from entering alphabetic characters?
EDIT
I only have something interesting:
#include<stdio.h> main(){ int input; printf("Choose a numeric value"); do{ scanf("%d",&input); }while(input!= 'int'); }
Adding "int" will continue as I enter the numbers, I tried "char", but that didn't work. Of course, something for the alphabets is correct ?: S Please answer!
Thanks for your help!
source share