# Buckyyy Challenge #2

 Plop See · September 10, 2016 ``#include#include#include#include#includeint main(){    srand(time(NULL));    int diceTotal;    int diceRolls[3];    int diceRollsFinal;    char a = 'A';    char userAnswer;    for (int I=0; I<3; I++){        diceRolls[I] = (rand()%6)+1;        printf("Dice roll %c = %d\n", a, diceRolls[I]);        a++;        diceTotal += diceRolls[I];    }    printf("The total of which is: %d\n", diceTotal);    printf("Will the next roll be (H)igher, (L)ower, or the (S)ame?\n");    scanf(" %c", &userAnswer);    diceRollsFinal = (rand()%6)+1;    if (diceRollsFinal > diceTotal && userAnswer == 'H')        printf("Your right! The final roll, %d, was higher than the sum of the first 3 rolls of %d\n", diceRollsFinal, diceTotal);    else if (diceRollsFinal < diceTotal && userAnswer == 'L')        printf("Your right! The final roll, %d, was lower than the sum of the first 3 rolls of %d\n", diceRollsFinal, diceTotal);    else if (diceRollsFinal == diceTotal && userAnswer == 'S')        printf("Your right! The final roll, %d, was the same as the sum of the first 3 rolls of %d\n", diceRollsFinal, diceTotal);    else        printf("Your an idiot!\n");    return 0;}``I wasn't 100% sure what Bucky said the requirements were but I believe this is what he meant.... Basically this all works but obviously the answer is almost always 'L' since its 1 single die roll vs the sum of 3 of them. I've tried it a bunch of times till I got one where 'H' was the proper answer and it worked...Easy enough to change it to a 3roll vs 3roll later if that's what was supposed to be done.Thanks, hope you guys like it!.PS there seems to be some sort of bug with the forum... it doesn't show a lowercase i [I]  in code/normal text like I'm writing here. Had to change it to uppercase.... Perhaps its used by the forum as a tag for italics or something but it should be omitted in the code section at least. Thanks!

## Replies

Nothing to see here.

## C

130,990 followers