The objective of this assignment is to give the student
more practice in using loops, especially
embedding one loop inside the other. These are called "nested loops". The assignment also
provides the opportunity to work more
with random number generators.
The assignment is
composed of two parts
, but only
for the benefit of student comprehension.
only one program that does both parts a) and b) should be turned in by the student.
The two parts are:
Write a program
in C that
determines how many calls to a random number generator it
takes to match a number between 0 and 99 that is entered by a
Use a seeded
number generation function
; otherwise all iterations of the outer loop
(part b below)
Embed the above program in a second loop that makes this computation 50 times and
prints out the average number of times that
the program took to find a match
The output should be as follows:
The program took an average of <avg> random number generations to
match the target number
over the 50 experiments.
Recently Asked Questions
- A tennis ball contains 250mL of air at 1.25atm. A tennis star soupsit up by injecting 50mL of air at 1 aim into the ball. Assuming no change in volume of the
- I need help with this problem I have been working on math homework for 4 hours and need sleep.
- what would the best answer bejQuery22407848977082561461_1529654706663 I am not sure how to answer these myself You have proportional (percentages) data