Is there any way to simplify this if statement?
if(num1 != 1 && num1 != 2 && num1 != 3 && num1 != 4 && num1 != 5 && num1 != 6 && num1 != 7 && num1 != 8 && num1 != 9 && num1 != 0){
printf("Invalid Number");
return 0;
}
The value of num1 will be from user input, and I want to only allow numbers as value and if the user tries to input anything other than number, I want Invalid Number to be printed.