Advertisement
ppupil2

check-input

Mar 29th, 2020
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.23 KB | None | 0 0
  1. /* input & check validation*/
  2.     while (1) {
  3.         printf("Enter epsi: ");
  4.         fflush(stdin); ch = '\0';
  5.         scanf("%d%c", &a, &ch);
  6.         if (a>0 && ch == '\n') {
  7.             break;
  8.         }
  9.         else {
  10.             printf("Invalid input, please re-enter!\n");
  11.         }
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement