Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program (main) that reads 5 integers entered by the user and stores in an array. The program calls average odds function to

    Write a program (main) that reads 5 integers entered by the user and stores in an array. The program calls 



    Expected output of the program: Enter 5 numbers: 8 23 71 6 5 The average of odd(s) : 33.0 The average of even(s) : 7.0 The av  

Write a program (main) that reads 5 integers entered by the user and stores in an array. The program calls average odds function to display the average of the odds, calls average evens function to display the average of the evens. Finally, the program calls compare function for the average of the odds (first argument) and the average of the evens (second argument). If compare. function returns true, it displays "The average of odd(s) is greater than the average of even(s)." message. Otherwise, it displays "The average of even(s) is less than the average of odd(s).". The program has three latter functions average odds, average_evens, and compare. Here are the prototypes for the latter three functions: float average odds(int arr[], int arr size); Calculates the average of the odd numbers in array arr. float average_evens(int arr[]); Calculates the average of the even numbers in array arr. bool compare(float first_num, float second_num); Compares two floating point number. If the first number is greater than second number, it returns true. If the second number is greater than first number, it returns false. Expected output of the program: Enter 5 numbers: 8 23 7165 The average of odd(s) : 33.0 The average of even(s) : 7.0 The average of odd(s) is greater than the average of even(s). Enter 5 numbers: 86 60 3 9 43 The average of odd(s) : 18.3 The average of even(s) : 73.0 The average of odd(s) is less than the average of even(s). PA

Step by Step Solution

There are 3 Steps involved in it

Step: 1

C program include float averageoddsint arr int arrsize float averageevensint arr bool comparefloat f... 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

Recommended Textbook for

Managers and the Legal Environment Strategies for the 21st Century

Authors: Constance E. Bagley

7th edition

1111530637, 978-1285319636, 978-1111530631

More Books

Students also viewed these Accounting questions

Question

=+b) Is this model appropriate for this series? Explain.

Answered: 1 week ago

Question

=+61. Refer to Exercise 46 of Section 7.4.

Answered: 1 week ago

Question

=+60. Refer to Exercise 42 of Section 7.4.

Answered: 1 week ago