Guest User

Untitled

a guest
Oct 24th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.99 KB | None | 0 0
  1. //
  2. //  main.c
  3. //  work
  4. //
  5. //  Created by PHR34K on 9/5/11.
  6. //
  7.  
  8. #include <stdio.h>
  9.  
  10. int main ()
  11. {
  12.     int myInt = 6;
  13.     int otherInt = 12;
  14.     int userInt;
  15.     int myChar = 'Y';
  16.    
  17.    
  18.    
  19.     while (myChar == 'Y')   {
  20.        
  21.        
  22.         printf("Please enter either 6 or 12: ");
  23.         scanf(" %d", &userInt);
  24.        
  25.         if (userInt == myInt) {
  26.            
  27.        
  28.         printf("You entered 6.\nEnter Y to restart or N to exit: ");
  29.         scanf(" %c", &myChar);
  30.        
  31.         }
  32.        
  33.         else if (userInt == otherInt)   {
  34.            
  35.             printf("You entered 12.\nEnter Y to restart or N to exit: ");
  36.             scanf(" %c", &myChar);
  37.            
  38.         }
  39.        
  40.         else    {
  41.            
  42.             printf("You entered neither. Can't you read?\nEnter Y to restart or N to exit: ");
  43.             scanf(" %c", &myChar);
  44.            
  45.         }
  46.        
  47.        
  48.     }
  49.    
  50.     printf("Terminated.");
  51.    
  52.    
  53. }
Add Comment
Please, Sign In to add comment