Last active
November 22, 2018 07:51
-
-
Save winhtut/264e047dc86df847ddcdb6f14f764a3a to your computer and use it in GitHub Desktop.
Lottery Game for Student
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<stdlib.h> | |
| int main(){ | |
| int age=0; | |
| int id=0; | |
| int number=0; | |
| int num=0; | |
| printf("########################## Welcome to our lottery Game! ##########################\n"); | |
| printf("Please enter your age!"); | |
| scanf("%d",&age); | |
| if( age >=18){ | |
| while ( age > 17){ | |
| printf("Please enter your id:"); | |
| scanf("%d",&id); | |
| while( id == 111){ | |
| printf("Please enter your lottery number :"); | |
| scanf("%d",&number); | |
| if ( number == 123){ | |
| printf("You are win in lottery\n"); | |
| printf("If you want to play again press 1"); | |
| printf(" If you want to quit press 2"); | |
| scanf("%d",&num); | |
| if( num == 1){ | |
| printf("You can play again\n"); | |
| }else{ | |
| printf("Good bye"); | |
| exit(0); | |
| } | |
| }else{ | |
| printf("000-Try again-000 \n"); | |
| } | |
| } | |
| } | |
| }else{ | |
| printf("You are not enough to play game:"); | |
| } | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<stdlib.h> | |
| int main(){ | |
| int age=0; | |
| int id=0; | |
| int number=0; | |
| int num=0; | |
| int money=0; | |
| printf("########################## Welcome to our lottery Game! ##########################\n"); | |
| printf("Please enter your age!"); | |
| scanf("%d",&age); | |
| if( age >=18){ | |
| while ( age > 17){ | |
| printf("Please enter your money:"); | |
| scanf("%d",&money); | |
| while( money > 999){ | |
| while ( age > 17){ | |
| printf("Please enter your id:"); | |
| scanf("%d",&id); | |
| while( id == 111){ | |
| printf("Please enter your lottery number :"); | |
| scanf("%d",&number); | |
| if ( number == 123){ | |
| printf("You are win in lottery\n"); | |
| printf("This is your money %d\n",win(money)); | |
| printf("If you want to play again press 1"); | |
| printf(" If you want to quit press 2"); | |
| scanf("%d",&num); | |
| if( num == 1){ | |
| printf("You can play again\n"); | |
| }else{ | |
| printf("Good bye"); | |
| exit(0); | |
| } | |
| }else{ | |
| printf("000-Try again-000 \n"); | |
| } | |
| } | |
| } | |
| } | |
| } | |
| }else{ | |
| printf("You are not enough to play game:"); | |
| } | |
| return 0; | |
| } | |
| int win(int x){ | |
| return x*20; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment