#include #include #include int main() { int x, y, z, balance=100; int invest, guess, outcome; srand(time(NULL)); printf("Let's start to play the game with 3 dices\n"); printf ("Your balance = $100\n"); while ( balance > 0 && balance < 1000) { do { printf("How much do you invest? "); scanf ("%d", &invest); }while (invest > balance || invest % 10 != 0); do{ printf("What is your expected outcome, big (1) or small (0)? "); scanf("%d", &guess); }while ( guess != 1 && guess != 0); x = rand() %6 + 1; y = rand() %6 + 1; z = rand() %6 + 1; printf(" The points of the 3 dices are %d %d %d\n", x, y, z); if (x + y + z <=10) { outcome = 0; printf ("It is small, "); } else { outcome = 1; printf ("It is big, "); } if ( guess == outcome) { balance = balance + invest; printf("a correct guess\n"); printf(" Your balance = %d\n", balance); } else { balance = balance - invest; printf("an incorrect guess\n"); printf(" Your balance = %d\n", balance); } } return 0; }