The "dice" function implements a pseudo-random number generator that is used to simulate the throwing event of a die, the result of which can be the value of one of the 6 sides of the die, that is, an...


The "dice" function implements a pseudo-random number generator that is used to simulate the throwing event of a die, the result of which can be the value of one of the 6 sides of the die, that is, an integer value from 1 to 6 .
image


Write a C program that includes the above statement (before main) and use the given function internally to calculate the average of n rolls of the die, where n is a positive integer entered by the user using scanf. To calculate the average, we have to add the value obtained from each roll of the die and divide this sum by n. Since n is an integer, the variable that accumulates the mean must be double so that the mean value has decimal places, as requested below. The mean value must be printed with printf to one decimal place.


#include <stdio.h><br>#include <stdlib.h><br>int dado()<br>{<br>return rand ()%6+1;<br>

Extracted text: #include #include int dado() { return rand ()%6+1;
For example:<br>Input Result<br>1000<br>3.5<br>

Extracted text: For example: Input Result 1000 3.5

Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here