Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C lanuguage please 19.4 Programming Assignment-04 In this programming assignment, you will write a C program that uses input, output, function calls, and preprocessor directives

C lanuguage please image text in transcribed
image text in transcribed
19.4 Programming Assignment-04 In this programming assignment, you will write a C program that uses input, output, function calls, and preprocessor directives for doing some basic mathematical computations. You will also organize your program into separate source and header files. Create a header file named functions. In this file, you will do the following o include the header guards o Write a preprocessor directive to representa constant value for an array size. Name it LENGTH and give the replacement value 5. . You will write two functions (see below functions.c). Declare their prototypes. Function names should be exactly as shown below Create a source file named functions.c In this file, you will do the following Write a function named average () that takes in an array of integers It retums the average of the array as a double value. Use pass by value - Write a function named quadraticFormula() that solves for the two x values. It takes in five parameters: the arguments for the equation a, b, and c plus two parameters passed by pointer/reference so that the both values (x1 and 2) can be sent back to the caller. Assume all parameters are of type double The tunction returns nothing Here is the mathematical formula below (source: Wikipedia) -b 8 - 4ac 2a Assume that a > and the value under the root is always greater than 0 e b2 > 4ac o Assume that a > 0 and the value under the root is always greater than leb^2 > 4ac o The first result x1 is when you add the square root expression and the second result x2 is when you subtract the square root expression . No printf() statements can exist in these functions in this file. All printing will happen in main Write the main() that will do the following 6 Declare an array with 5 integer values use the LENGTH Using a for loop, ask the user to input a value for each of the array elements. Assume the user will always enter a valid value as input o Next, ask the user for three values a, b, and c arguments that will be passed to the quadraticFormula() function. It will pass two additional variables by pointer Call the average(function with the array as the argument. o call the quadraticFormula() with the arguments a, b, c and the result variables xi and x2 passed by reference Print the results. First line should print the average of the array, Next, print the updated result values for 1 and 2 each in a separate line The output must look exactly like below in terms of formatting There is only one space between the colon and the result Results are shown with exactly two decimal places The example shows the solutions for when the array contains (1e, 20, 30, 40, 50] and when a - 2,5 - 5, and c = -3. averago 30.00 x1; 0.50 X2: 3.00 Save your files as main.c functions.c, and functions.h and upload them below for grading

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

What are your dreams for me?

Answered: 1 week ago

Question

In which of the following environments can sound travel fastest?

Answered: 1 week ago

Question

Which type of energy does an object have when it is in motion?

Answered: 1 week ago

Question

The working principle of a washing machine is?

Answered: 1 week ago

Question

Nuclear sizes are expressed in a unit named?

Answered: 1 week ago