Question: on C programming lunguage with test cases Question 2 (10 marks) sinhix) Ever wonder how the standard C math functions make their calculations. This question

on C programming lunguage

with test cases

on C programming lunguage with test cases Question 2 (10 marks) sinhix)

Ever wonder how the standard C math functions make their calculations. This

Question 2 (10 marks) sinhix) Ever wonder how the standard C math functions make their calculations. This question lets you explore how to compute hyperbolic sine of any value ofx, sinh(r). The following infinite series gives the value of sinh(x): 4+1 sinh x = x +-+--+-+ Equation 1 Such series serves as a basis for calculating sinh(x) in a program (i.c. in a function). O of terms for computing the value (it is impossible to compute an infinite number of terms). Thus the above equation becomes: f course a program has to limit the number i+1 sinh x = x +-+-+-+ Equation 2 Develop software that meets the following requirements: Prompts the user for the value of x and the number of terms, n, in the series used to compute sinh(r). . o Check that the number of terms given by the user is positive. Computes the value of sinh(r) using the above series and displays the results to the user Prompts the user to quit the program with the message "Do you wish to quit (y)?", and read in a character. Repeat the above steps if the user enters and stop the program if the user answers 'n Keep prompting the user if an invalid answer is entered. Print the message Program terminated" when the program terminates. . Respect the following guidelines: DO NOT use arrays or structures in your answer DO NOT use standard math functions in your answer Have the main function call a separate function, getInput, to get input values from the user. Recall that you can pass addresses to simple variables to a function in a parameter so that the function can fill in the variable value. Have the main function call a separate function, sinHyper, to compute the value of sinh(x). Given that the powers of x in the numerator and the factorial in the denominator will become very large in a very few terms, calculating the values of each term separately will quickly reach the limit of the computer. Use a strategy where the value of a term is calculated from the previous term. If we number the terms using i starting at 0 (and the term to = x), then the term t, can be computed from the previous term t/ as follows: o o i-1 (2i +1)2i o The above computation does not involve the same large numbers as the numerator/denominator of the terms in Equation 2. If n is the number of terms used to calculate sinh(x), then i varies between 0 and n-1 (ie, N = n-1 in Equation 2). o .A loop to control termination of the program is part of the main function. o Recall that fflush function should be called before reading in a character input from the user

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!