# challenge 2 guessing game

 Amit Vikram · June 24, 2015 #include #include #include #include #include int main(){int i;int diceroll;int dice2;int dicethrow;int total;int answer;int totals;for(i=0; i<1; i++){    srand(time(NULL));    diceroll = ( rand()%6 )+ 1;    printf(" %d \n", diceroll);    dice2 = ( rand()%6 )+ 1;    printf(" %d \n", dice2);    dicethrow = ( rand()%6 )+ 1;    printf(" %d \n", dicethrow);    total = diceroll + dice2 + dicethrow;    printf("total is : %d \n", total);    puts("predict if next total will be high or low");    puts(" high is above 10 and low is below 10 ");    puts(" press 1 for high and 2 for below");    scanf(" %d \n", &answer);    diceroll = ( rand()%6 )+ 1;    printf(" %d \n", diceroll);    dice2 = ( rand()%6 )+ 1;    printf(" %d \n", dice2);    dicethrow = ( rand()%6 )+ 1;    printf(" %d \n", dicethrow);    totals = diceroll + dice2 + dicethrow;      printf("total is : %d \n", totals);    if((totals>10) && (answer==1)){printf("good job");}    if((totals<10) && (answer==2)){printf("good job");}    if((totals<10) && (answer==1)){printf("bad job");}    if((totals>10) && (answer==2)){printf("bad job");}    if(totals==10){printf("neither good nor bad");}}return 0;}

## Replies

 William Frost · June 26, 2015 First of all, use the code tag. secondly, where is the bloody comments?
• 1

## C

120,710 followers