int n; while (scanf("%d", &n) == 0 || n < 0) // if no values captured, or the result is negative { printf("Incorrect. Write a positive integer."); fseek(stdin,0,SEEK_END); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)