Write a sequence of c statements that prompts for and


1. Write a sequence of C++ statements that prompts for and accepts 2 integer values, say n1 and n2, from a user, and then outputs the sum of the values from n1 to n2, inclusively. For example, if the user inputs the values 5 and 10, then the value 45 (the sum of 5+6+7+8+9+10) should be output. You should assume that the value of n2is greater than or equal to the value of n1. (Define all variables that you use, including those corresponding to n1and n2.)

2. Complete the body of the following function that should return (not output) the factorial of the value specified by the parameter n. Your code should include the definitions of all of the variables that you use.

int Factorial(int n)

{

3. Write the code for (i.e., define) the function ToCelsius that has a single parameter of type double representing a temperature in Fahrenheit, and returns the equivalent temperature in Celsius. For example, using this function the following statement should output the value 27.5.

cout << ToCelsius(81.5);

For reference: Celsius degrees = 5/9(Fahrenheit degrees - 32)

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Write a sequence of c statements that prompts for and
Reference No:- TGS02797422

Now Priced at $15 (50% Discount)

Recommended (90%)

Rated (4.3/5)