Guest User

Untitled

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