Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions