Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h> // for output
- int main () // execution starts here
- {
- printf("Who will enter the number(or string) first? If Mr. X wants to enter first, press 1; if Y wants to enter first, press 2\n");
- // this is a comment
- // /n means new line
- int reply;
- int xNum, yNum;
- scanf("%d", &reply);
- // &reply means the address of reply
- if (reply==1)
- {
- printf("Welcome Mr. X, Please enter a number\n");
- scanf("%d", &xNum); // %d means format as decimal number
- printf("Welcome Mr. Y, Please enter a number\n");
- scanf("%d", &yNum);
- }
- else // in fact anything but 1
- {
- printf("Welcome Mr. Y, Please enter a number\n");
- scanf("%d", &yNum);
- printf("Welcome Mr. X, Please enter a number\n");
- scanf("%d", &xNum);
- }
- printf("Mr. X entered %d and Mr Y %d\n",xNum,yNum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment