#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
int main()
{

   char start,guess,hold[5];
   int i,sum;
   int diceRoll,diceGuess;
    printf("Start now? y/n: ");
    scanf(" %c", &start);
    if(start=='y'){ /*/Start of the program/*/
        srand(clock(NULL));
        rand();
   for(i=0;i<= 2;i++){
        diceRoll = rand()%6+1 ;
        printf("%d \n",diceRoll);
        hold = diceRoll;
    }
    sum = hold[0] + hold [1] + hold [2];
    printf("The sum of 3 dice is %d \n",sum);
    printf("Guess the next dice if it is higher/lower/same(press h/l/s): ");
    scanf(" %c", &guess);
    if(guess=='h'){
        diceGuess = 1 + rand()%6;
        if(diceGuess>sum){
            printf("The value of next dice is %d \n",diceGuess);
            printf("You guess it right!");
        }
        else{
            printf("The value of next dice is %d \n",diceGuess);
            printf("You suck!");
        }
    }else if(guess=='l'){
        diceGuess = 1+ rand()%6;
        if(diceGuess<sum){
            printf("The value of next dice is %d \n",diceGuess);
            printf("You guess it right!");
        }
        else{
            printf("The value of next dice is %d \n",diceGuess);
            printf("You suck!");
        }
    }else if(guess=='s'){
        diceGuess = 1 + rand()%6;
        if(diceGuess==sum){
            printf("The value of next dice is %d \n",diceGuess);
            printf("You guess it right!");
        }else{
            printf("The value of next dice is %d \n",diceGuess);
            printf("You suck!");
        }

    }else{
        printf("Keyboard much?");
    }
   }else{
        printf("Keyboard much?");
    }

    return 0;
}