when i type anything but a number the program starts a endless loop. what code can i write into the program to stop this ,and what causes the loop.
Code:#include <stdio.h> int main() { int x; printf("enter a numbr 1 thru 10\n"); scanf("%d",&x); if (x<1 || x>10) main(); else printf("\nyou typed %d",x); return(0); }