#include <stdio.h>
#include <stdlib.h>

int main()
{
    int diceRoll1, diceRoll2, diceRoll3;
    char ans, realAns, sum1, sum2;

    srand(time(NULL));

    diceRoll1 = ( rand() %6 ) +1;
    diceRoll2 = ( rand() %6 ) +1;
    diceRoll3 = ( rand() %6 ) +1;
    sum1 = diceRoll1 + diceRoll2 + diceRoll3;

    printf("This a dice rolling game. You will roll dice thrice.\n");
    printf("Lets start the game.\n");
    printf("Your first, second and third numbers are: %d, %d, %d \n", diceRoll1, diceRoll2, diceRoll3);
    printf("Therefore the sum of three numbers is %d.\n", sum1);

    printf("What will be your next sum compare to this? \t (h-higher, s-same, l-low)\n");
    scanf(" %c", &ans);

    diceRoll1 = ( rand() %6 ) +1;
    diceRoll2 = ( rand() %6 ) +1;
    diceRoll3 = ( rand() %6 ) +1;
    sum2 = diceRoll1 + diceRoll2 + diceRoll3;

    printf("Your next three numbers are: %d, %d, %d \n", diceRoll1, diceRoll2, diceRoll3);
    printf("Therefore the sum of three numbers is %d.\n", sum2);

    if(sum1 == sum2){
        realAns = 's';
    }else if(sum1 < sum2){
        realAns = 'h';
    }else{
        realAns = 'l';
    }
    (ans == realAns) ? printf("You guess the correct answer. \n") : printf("Your answer is wrong. \n");

    return 0;
}