Question: Write a C program that generates 100 random integer numbers in the range from 1 to 100 by calling rand () function, and displays 10
Write a C program that generates 100 random integer numbers in the range from 1 to 100 by calling rand () function, and displays 10 numbers in a row. The program then checks how many numbers are even numbers and how many are odd numbers. A function with the following function prototype is required to do the counting, and output the results on the screen,
void counting_even_numbers(int a[ ], int n);// where n represents the size of the array a.
An example run of the program is as follows,
The initial set of 100 number is:
(100 random numbers)
There are 49 even numbers in the range from 1 to 100.
There are 51 odd numbers in the range from 1 to 100.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
