Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program with a main function. Declare an array of type double with the name userdata with 5 elements (numbered 0-4). Use a

Write a C program with a main function.

Declare an array of type double with the name "userdata" with 5 elements (numbered 0-4).

Use a for loop to scanf the value from the keyboard into each array element.

After all the array elements have been entered by the user, use a second for loop to printf the value of each array element to the screen.

In addition, do the following:

Use a function to display description info to the user (just a few brief sentences).

Use a function to determine the maximum value in the array and return the maximum value to the calling program. Display this maximum value from main().

Use another function to determine the minimum value in the array and return the minimum value to the calling program. Display this minimum value from main().

Hint for determining max/min:

Declare variables of type double with names indicating maximum and minimum.

For an initial value, set this equal to the first element (element #0) of the array.

For each iteration of the for loop, compare the value of the array element with the previously-set maximum/minimum value and adjust the maximum/minimum variable values accordingly.

Test with the following user-entered values:

-2.1, -5.9, 4.7, 8.9, -3.0

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

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions