Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<conio.h>
- int main() {
- int age = 0;
- int smoney = 0;
- int id = 0;
- int number = 0;
- int money = 0;
- int num = 0;
- printf("**Welcome to our lottery game**\n\n");
- printf("Enter your age: ");
- scanf_s("%d", &age);
- if (age > 17) {
- printf("Show your money: \n");
- scanf_s("%d", & smoney);
- printf("This is your show money:%d\n", smoney);
- while (age > 17) {
- printf("Enter your id: \n");
- scanf_s("%d", &id);
- while (id == 111) {
- printf("Enter your money <must be more than 1000ks>: ");
- scanf_s("%d", & money);
- while(money>900) {
- printf("Enter your number:");
- scanf_s("%d", & number);
- if (number == 222) {
- printf("You win the lottery\n");
- smoney = (money * 10 + smoney)-money;
- printf("This is your money: %d\n", smoney);
- printf("If you want to play game press 1\n");
- printf("If you want to quit game press 2\n");
- scanf_s("%d", &num);
- if (num == 1) {
- printf("You can play again\n");
- }
- else {
- printf("Good bye!!");
- exit(0);
- }
- }
- else {
- printf("Try again!!!\n");
- smoney = smoney - money;
- printf("This is your remain money: %d\n", smoney);
- printf("If you want to play game press1\n");
- printf("If you want to quit the game press 2\n");
- scanf_s("%d", &num);
- if (num == 1) {
- printf("You can play again\n");
- }
- else {
- printf("Good bye!!");
- exit(0);
- }
- if (smoney < 1000) {
- printf("Try more!!\n you have not enough money\n");
- exit(0);
- }
- }
- }
- }
- }
- }
- else {
- printf("You cannot play game\n");
- }
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement