# Challenge#2 Done

 laith elhamwi · December 28, 2014 #include #include #include #include #include int main(){  int a;  int dice1;  int sum1=0;  int b;  int sum2=0;  int dice2;  char c;  printf("Lets play \n");  printf("I am going to throw the dice three times \n and i will collect the total sum of the numbers that show. ");  printf("\n Your job is to guess if the next number that appears is higher , lower or equal to the first number. \n");for(a = 0 ;a < 3; a++){    dice1=(rand()%6)+1;    sum1 += dice1;}printf("The number is :%d \n",sum1);printf ("Enter your guess: (h/l/e)\n");scanf(" %c",&c);if(c =='h'){    c ='h';}else if(c =='l'){    c='l';}else if(c =='e'){    c ='e';}else{     printf("Error");}for(b = 0; b < 3; b++){    dice2=(rand()%6)+1;    sum2 += dice2;}printf("The number is :%d \n",sum2);if(sum2>sum1 && c=='h'){    printf("Good Guess");}else if(sum2

## Replies

 Nishant Tadvi · December 28, 2014 I think you has took long method. Try to make small as much as you can. otherwise it is perfect.
• 1

## C

129,978 followers