if(department<1 || department>9)
printf("\nError (digit only)\n");
The above code is a part from my program to get data for a stock report. My department is meant for a digit between 1 and 9. Is the way I did correct? And, the above code will print Error if I enter a number between 1 and 9. Is there any other way to validate the user input data so that department only take digit between 1 and 9?
Thanks in advance.