Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Language in c++

image text in transcribed

. 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

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

10. What is meant by a feed rate?

Answered: 1 week ago

Question

6. How would you design your ideal position?

Answered: 1 week ago

Question

2. How do they influence my actions?

Answered: 1 week ago