Guess the sum of the output of two dice rolls!!Calculate is they are same or different!
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
int main()
{
int diceRoll1,i,diceroll2,total1=0,total2=0;
char op;
for(i=0;i<=20;i++){
diceRoll1 = (rand()%6)+1;
total1+=diceRoll1;
}
printf("The first sum : %d\n",total1);
printf("Enter your opinion?\nH=higher\nL=lower\nS=same\n");
scanf("%c",&op);
(op=='H' && total1>total2)?(printf("You are awsome!\n")):((op=='L' && total1<total2)?(printf("You are accurate!\n")):((op=='S' && total1==total2)?
(printf("You are wizard!\n")):
(printf("You are dumbass!\n "))));
for(i=0;i<=20;i++){
diceroll2 = (rand()%6)+1;
total2+=diceroll2;
}
printf("The second sum : %d\n",total2);
return 0;
}
Comments
Post a Comment