#include #include #include int main() { int x, y, z, balance=100; int invest, guess, outcome; printf("Let's start to play the game with 3 dices\n"); printf("Your balance = $%d\n\n", balance); srand(time(NULL)); 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"); } else { balance = balance - invest; printf("an incorrect guess\n"); } printf("Your balance = $%d\n\n", balance); } return 0; }