0

OK I wrote this dice program up and it works really well. Just curious though if there was a way to reduce the number of "if" statements.

```
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SIZE 11
#define TOTAL 36000
int main(void)
{
int cnt = 0;
int die1, die2, sum;
int array[SIZE];
srand(time(NULL));
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;
if (sum == 2)
array[0] = array[0] + 1;
if (sum == 3)
array[1] = array[1] + 1;
if (sum == 4)
array[2] = array[2] + 1;
if (sum == 5)
array[3] = array[3] + 1;
if (sum == 6)
array[4] = array[4] + 1;
if (sum == 7)
array[5] = array[5] + 1;
if (sum == 8)
array[6] = array[6] + 1;
if (sum == 9)
array[7] = array[7] + 1;
if (sum == 10)
array[8] = array[8] + 1;
if (sum == 11)
array[9] = array[9] + 1;
if (sum == 12)
array[10] = array[10] + 1;
}
for (cnt = 0; cnt < SIZE; cnt++)
printf("Number of %d's: %d\n", cnt+2, array[cnt]);
return 0;
}
```