Question: Language: C++ computation . The formula f has two inputs: n (date type: int) and x (date type: double). The result of f is also

Language: C++ computation

Language: C++ computation . The formula f has two inputs: n (date

. The formula f has two inputs: n (date type: int) and x (date type: double). The result of f is also double type. f = n/(x+/1 + x/2+x/3 + ... +x") Write a program according to the following requirements: For the inputs of n and x, we assume that they are already the int-type and double-type numbers, respectively, i.e., you do not need to check whether they are belonged to any other data types. For the input n, please check whether it is positive. If no, ask the user to input n again. Next, for the input x, check whether 0.1 SxS 1. If no, ask the user to input x again. If both n and x are valid, please use the loop statements to compute the value off and output the result with only two digits in the decimal part. Note 1: Your code should NOT use the function pow(x,i). Note 2: You can compute the denominator first f = x'/1+x2/2 + x3/3+...+x" and then f = n/f. Example-1 (Inputs are underlined): Please input n (positive): 3 Please input x (0.IX=1): 1 The value of fis: 1.64 Example-2 (Inputs are underlined): Please input n (positive): 50 Please input x (0.1

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!