Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- int main()
- {
- int total, coin, game, reminder, reminder2;
- char ans;
- do{
- printf("Enter a coin [10p,20p,50p]: \n");
- scanf("%d", &coin);
- if(coin!=10 && coin!=20 && coin!=50 && coin!=0){
- printf("invalid coin \n");
- }else
- total=total+coin;
- }while(coin!=0);
- printf("Total is: %d \n", total);
- while(total>=50){
- total-=50;
- game+=3;
- }
- while(total>=20){
- game++;
- total-=20;
- }
- printf("you have: %d games", game);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement