Guest User

Untitled

a guest
Oct 22nd, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4.  
  5. {
  6.     int myInt = 6;
  7.     int otherInt = 12;
  8.     int userInt;
  9.    
  10.     //'go1:' sets the point where to jump to
  11.     go1: printf ( "Please put in the number '6' or the number '12': " );
  12.    
  13.     scanf ( "%d",&userInt );getchar();
  14.    
  15.     if ( userInt == myInt )
  16.        
  17.         {
  18.             printf("You entered: 6!\n");
  19.         }
  20.    
  21.     else if (userInt == otherInt)
  22.        
  23.         {  
  24.             printf ( "You entered 12!\n" );
  25.         }
  26.    
  27.     else
  28.        
  29.         {
  30.             printf(  "Can't you read? Try again!" );
  31.             getchar();
  32.             // This is where I want it to go back to the VERY first 'printf'. Thanks for your help
  33.             // Please :P
  34.             // 'goto go1' = jump to where 'go1:' is
  35.             goto go1;
  36.         }
  37.  
  38.     return 0;
  39. }
Add Comment
Please, Sign In to add comment