Public feed #723999

Miscellany

public c v1 · immutable
Raw Edit
·published 2007-10-03 07:11 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>#include <time.h>void main (){    time_t t;    int num, wheel, guess, bet, result;    srand((unsigned) time(&t));    num = (rand() % 21) + 1;    printf("Please place bet: ");    scanf("%d", &bet);    printf("Please pick a number that you think the wheel will land on: ");    scanf("%d", &guess);    if (num <=8)        result = 1;    else if (num<=14)        result = 2;    else if (num<=18)        result = 5;    else if (num<=20)        result = 10;    else if (num== 21)        result = 25;    if ( guess == num )        printf("%s%d!\n", "You won $", result * guess);    else        printf("%s%d\n", "You lose! The wheel landed on ", num);}