Question: Use the random ( ) function to generate 5 0 integers between 1 - 1 0 0 . Count the frequencies of odd numbers and

Use the random() function to generate 50 integers between 1-100. Count the frequencies of odd numbers and even numbers that generate. You can consider to use two variables or an array of length 2 to store the frequencies. Then print the frequencies using printf().
Part 2
Use the random() function to generate 50 integers between 1-100. Count the frequencies of each number. Then use scanf() to retrieve the frequency of a specific number. Print the frequency of that number if the frequency is not 0, otherwise print "This number never appears". If the inquired number is out of range, print "The number is out of range". After that, check the frequency of all odd numbers. Report the percentages as well as the counts. The percentages should be shown with one digit after the decimal.
Think about the following questions:
(1) How do you initialize the counter array?
(2) What should be the length of the counter array? Notice that "0" is not in the range.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!