Guest User

Error Checking For Loop

a guest
Mar 24th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. //Step1: Get input from user
  2. for ( x = 1, x <= 1; ) /* Start a loop for error checking */
  3. {
  4. printf("Please enter N > (an integer) ");
  5. scanf("%d", &N);
  6. if ( N <= 0 )
  7. {
  8. printf ("Please input a number greater than 0\n");
  9. continue;
  10. }
  11.  
  12. /* Place your loop increment here */
  13. x++;
  14.  
  15. } /* End your loop */
Advertisement
Add Comment
Please, Sign In to add comment