# Dice challenge is not working properly.

 Andrew Smith · September 16, 2015 When playing the program it will not get passed the first if else why is that? #include #include #include #include #include int main(int argc, char *argv[]){int i;int j;int diceRoll1;int diceRoll2;int diceRoll3;int totalNumber1;int totalNumber2;char guess;srand (time(NULL));    for(i=0; i<1; i++){        diceRoll1 = ( rand()%6 ) +1;        printf("Dice roll one is %d \n", diceRoll1);        }    for(i=0; i<1; i++){        diceRoll2 = ( rand()%6 ) +1;        printf("Dice roll two is %d \n", diceRoll2);        }    for(i=0; i<1; i++){        diceRoll3 = ( rand()%6 ) +1;        printf("Dice roll three is %d \n", diceRoll3);        }    totalNumber1 = diceRoll1 + diceRoll2 + diceRoll3;    printf("your total roll is %d \n\n\n", totalNumber1);    printf("Do you think your next roll will be higher, lower, or the same?\n");    printf("Type h for higher, l for lower, and s for same.\n");        scanf("%c", &guess);srand (time(NULL));    for(j=0; j<1; j++){        diceRoll1 = ( rand()%6 ) +1;        printf("Dice roll one is %d \n", diceRoll1);        }    for(j=0; j<1; j++){        diceRoll2 = ( rand()%6 ) +1;        printf("Dice roll two is %d \n", diceRoll2);        }    for(j=0; j<1; j++){        diceRoll3 = ( rand()%6 ) +1;        printf("Dice roll three is %d \n", diceRoll3);        }    totalNumber2 = diceRoll1 + diceRoll2 + diceRoll3;    printf("your total roll is %d \n\n\n", totalNumber2);if(guess == 'h' || 'H') {    if(totalNumber2 > totalNumber1){        printf("you are correct!");    }else{            printf("you were incorect..");    }}else if(guess == 'l' || 'L') {    if(totalNumber2 < totalNumber1){        printf("you are correct!");    }else{            printf("you were incorect..");    }}else if(guess == 's' || 's') {    if(totalNumber2 == totalNumber1){        printf("you are correct!");    }else{            printf("you were incorect..");    }}    return 0;}

## Replies

 Jon Z. · September 16, 2015 ``if(guess == 'h' || guess == 'H')`` Andrew Smith · September 17, 2015 Thank you!
• 1

## C

124,524 followers