Is there a way to keep this code from breaking if anything but a number is entered. Any help would be appreciated.
#include <stdio.h>
int main(){
int x;
while(1){
printf("Enter a number: ");
scanf("%d", &x);
printf("You entered %d\n", x);
}
}