Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.c
- // work
- //
- // Created by Brent Borton on 9/5/11.
- // Copyright (c) 2011 Big Brother Software. All rights reserved.
- //
- #include <stdio.h>
- int main ()
- {
- int myInt = 6;
- int otherInt = 12;
- int userInt;
- int myChar = 'Y';
- while (myChar == 'Y') {
- printf("Please enter either 6 or 12: ");
- scanf(" %d", &userInt);
- if (userInt == myInt) {
- printf("You entered 6.\nEnter Y to restart or N to exit: ");
- scanf(" %c", &myChar);
- }
- else if (userInt == otherInt) {
- printf("You entered 12.\nEnter Y to restart or N to exit: ");
- scanf(" %c", &myChar);
- }
- else {
- printf("You entered neither. Can't you read?\nEnter Y to restart or N to exit: ");
- scanf(" %c", &myChar);
- }
- }
- printf("Terminated.");
- }
Add Comment
Please, Sign In to add comment