//Program to find sum of two dies if rolled 500
times.
#include
<stdio.h>
#include
<stdlib.h>
#define
TOTAL 500
#define
SIZE 11
void
main()
{
int cnt = 0;
int die1, die2, sum;
int array[SIZE];
clrscr();
for (cnt = 0; cnt < SIZE; cnt++)
{
array[cnt] = 0;
}
for (cnt = 0; cnt < TOTAL; cnt++)
{
die1 = rand() % 6 + 1;
die2 = rand() % 6 + 1;
sum = die1 + die2;
++array[sum-2];
}
for (cnt = 0; cnt < SIZE; cnt++)
{
printf("Number of %d's: %d\n",
cnt+2, array[cnt]);
}
getch();
}