Question: Please use print f for this assignment. Code on previous homework assignment: #include #include #include #include int main(void) { int numtoss = 0,dice,d[7]={0},j; int toss=0,max;
Please use print f for this assignment.
Code on previous homework assignment:
#include
#include
#include
#include
int main(void) {
int numtoss = 0,dice,d[7]={0},j; int toss=0,max;
int freq[36] = {0};
srand(time(NULL));
printf("How many times would you like to roll the dice?: ");
scanf("%d",&numtoss);
printf("how many dice do you want to roll(1-6):");
scanf("%d",&dice);
for(int i=1;i
{ for(j=1;j
freq[toss] = freq[toss] + 1; toss=0;
}
for(toss = dice; toss
{
printf("%d was rolled %d times ", toss, freq[toss]);
}
return 0;
}
output:
How many times would you like to roll the dice?:
200
how many dice do you want to roll(1-6):2
2 was rolled 3 times
3 was rolled 11 times
4 was rolled 18 times
5 was rolled 24 times
6 was rolled 23 times
7 was rolled 32 times
8 was rolled 27 times
9 was rolled 34 times
10 was rolled 14 times
11 was rolled 7 times
12 was rolled 7 times
Assignment #18: Dice Histogram (Project) Modify the previous assignment so that you are now throwing two dice. You should also add a Histogram to your output. A partial example of your output appears below. Limit the number of tosses to the maximum size of your Histogram. printf!!!! The two dice were tossed 100 times. Dice Total Frequency Histogram 0 0 5 1 0 1 5 2 0 2 3 5 6 7 5 7 7 9 12 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
