#include // printf #include // rand and srand #include // time int roll_dice(int Sides) { return (rand()%Sides)+1; } int main() { // Init: int FirstDice = 20; int SeccondDice = 8; srand(time(0)); int Average = 0; int Distribution[11]; //TODO: Set the right size. TIP: save the array size in a variable for later use // TODO: set all values of Distribution to zero using a for-loop // Calculate Distribution and Average for (int i = 0; i < 100000; i++) { int Value = roll_dice(FirstDice)+roll_dice(SeccondDice); // TODO: count up the frequency of the Value. // The smallest possible value 2 is supposed to be counted in index 0 Average = Average + Value; } Average = Average/100000; // Output code: // TODO: adjust this to the array size for(int i = 0; i < 6; i++) { printf("%d %d\n", i+2, Distribution[i]); } }