When I run the code it is outputting 0's for everything. Both rolls for the dice should be getting totaled and inserted into the array. It should roll both dice 36000 times and tally the results and output in the format. It will show me the proper format at the end however it does not insert any data into the array.
using System;
namespace DICE
{
public class DiceRoller
{
public static void Main()
{ // need to first create an object
Random random = new Random();
// generate the int for use in the array
int dice1;
int dice2;
// i need an array to take these numbers and store them for use
int[] dicerolls = new int[13];
// I used 12 for the index for the max value but maybe I should use 6 for one dice at a time?
for (int roll = 0; roll <= 36000; roll++) ; //for loop to roll 36,000 times
{
dice1 = random.Next(6) + 1;
dice2 = random.Next(6) + 1;
int total = dice1 + dice2;
dicerolls[total]++;
//adds the 2 dice rolls to create one total for output
}
// then i need to display to frequency in which those numbers appear
Console.WriteLine("Sum Frequency Percentage");
for (int roll = 2; roll < 13; roll++)
{
double percent = (dicerolls[roll] / 36000) * 100;
Console.WriteLine("{0}\t {1}\t\t{2:0.00}", roll, dicerolls[roll], percent);
}
}
}
}