Question: Task 3 ( 1 ) Write a C + + statement or a set of C + + statements for the following questions: ( a

Task 3
(1) Write a C++ statement or a set of C++ statements for the following questions:
(a) Sum the odd integers between 1 and 99 using for statement. Assume the integer variables "sum" and "count" have been declared.
(b) Print the value 333.546372 in a 15-character field with precisions of 1,2 and 3. Print each number on the same line. Left-justify each number in its field. State the outputs (What three values print?).
(c) Calculate the value of 2.5 raised to the power 3 using function pow. Print the result with a precision of 2 in a field width of 10 positions. State the outputs.
(d) Print the integers from 1 to 20 using a while loop and the counter variable x. Assume that the variable x has been declared, but not initialized. Print only 5 integers per line. [Hint: When x%5 is 0, print a newline character; otherwise, print a tab character.]* can combine with iflelse, etc. *
(e) With the same conditions in (d), write the answer using for statement.
Task 3 ( 1 ) Write a C + + statement or a set of

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 Programming Questions!