/*I'm sorry I'm not in the English-speaking world. Please understand. *My question is why line★ doesn't work?? *When it's constant instead of '(double)rand() / RAND_MAX', it works! */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void) {
    int cash = 50;
    int bets = 0;
    srand((unsigned)time(NULL));
    for (int i = 1; i <= 1000; i++) {
        while (cash > 0 && cash < 250) {
            if ((double)rand() / RAND_MAX < 0.5) ★
                cash++;
            else cash--;
        }
        if (cash == 250)
            bets++;
    }
    printf("initial amount $50\n");
    printf("target amount $250\n");
    printf("%d wins out of 1000\n", bets);
    printf("odds of winning=%lf", bets / 1000);
    return 0;
}
 
    