Question: C programming This program looks at random numbers (intergers) int he range of 0 through 99. The program prompts for the number of values to
C programming
This program looks at random numbers (intergers) int he range of 0 through 99. The program prompts for the number of values to generate in the range of 0 to 99, generates that many random numbers, and determines how many different (unique) numbers were actually generated.
Example executions:
How many random values to generate: 1
1 random values out of 100 possible values.
How many random values to generate: 10
10 random numbers generated 9 out of 100 possible values
Hints
Recall that the statement rand() % 100 will generate a random number in the range of 0 to 99
Use an array of 100 elements to store the number of times you've seeen the values 0, 1, 2, ....9.
Initialize this array to zeroes and also use srand(0) to seed your random number generator.
Your program should read in a number, then generate that many random numbers. For each random number generated, increment that location in the array by one.
After generating that many random numbers, count how many elements in the array are non zero.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
