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
- Exercise 7-22 Pronghorn, Inc. decided to establish a petty cash fund to help ensure internal control over its small cash expenditures. The following
- How do I go about solving these problems.If someone can walk me through a couple problems per part that would be great.
- Please refer to the attachment to answer this question. This question was created from Unit_2_Part_1__assignment.docx.