Hi,

Thanks for giving all the challenges since only when I practice I am able to figure out the nuances of 'c' programming :)

--------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>

/*comments
this is rolldice program
*/
int main()
{
    int i;
    int diceRoll;
    int totRoll;
    int randVal;
    char diceFlag;
    int totalGuess;
    int cont = 0;

    do {
        printf("Enter a guess of the total value (Enter 6 to 36) ");
        scanf(" %d",&totalGuess);
        }while(totalGuess>=37 || totalGuess <5);

    printf("Enter if total value will be (H-Higher L-Lesser S-Same) any other value to Exit? \n");
    printf("(any other value to Exit) \n");
    scanf(" %c",&diceFlag);

     printf("Dice Flag:%c \n", diceFlag);

    do {
        totRoll = 0;
         for(i=0;i<6;i++){
                randVal = ((double)rand() / ((double)RAND_MAX + 1) * 6);
                diceRoll = (randVal%6)+1;
                totRoll += diceRoll;
                printf("Random Value:%d \t Dice:%d \t Cum.Total:%d \n",randVal,diceRoll,totRoll);
        }

        printf("Final Total: %d \n",totRoll);

        if ((totRoll>totalGuess) && (diceFlag == 'H')){
            printf("Good Job the value derived is higher than the guess value \n");
            printf("Derived Total:%d \t Original guess:%d \t Dice Flag:%c \n",totRoll,totalGuess,diceFlag);
        } else if ((totRoll<totalGuess) && (diceFlag == 'L')){
            printf("Good Job the value derived is lower than the guess value \n");
            printf("Derived Total:%d \t Original guess:%d \t Dice Flag:%c \n",totRoll,totalGuess,diceFlag);
        } else if ((totRoll=totalGuess) && (diceFlag == 'S')){
            printf("Good Job the value derived is same as the guess value \n");
            printf("Derived Total:%d \t Original guess:%d \t Dice Flag:%c \n",totRoll,totalGuess,diceFlag);
        } else {
            printf("Bad Luck the value derived is not guess properly \n");
            printf("Derived Total:%d \t Original guess:%d \t Dice Flag:%c \n",totRoll,totalGuess,diceFlag);
        }

        printf("Enter if total value will be (H-Higher L-Lesser S-Same) any other value to Exit? \n");
        printf("(any other value to Exit) \n");
        scanf(" %c",&diceFlag);

        if ((diceFlag == 'H')||(diceFlag == 'L')||(diceFlag == 'S')){
            cont = 0;
        } else {
            printf("%c \n",diceFlag);
            cont = 9;
        }

    } while(cont==0);

   return 0;
}