Question: Question 3 (10 marks) Given the following excerpted program to calculate the area of rectangle and volume of a cube. The initial value of width,

 Question 3 (10 marks) Given the following excerpted program to calculate

Question 3 (10 marks) Given the following excerpted program to calculate the area of rectangle and volume of a cube. The initial value of width, length and height are given in the program in Figure 4. 1. #include 2. double width = 10.0, length = 0.5, power, height = 9.2; 3. double area, volume; 4. void main(void) { 5. printf("Calculate the area and volume: "); 6. printf("width = %.2f ", width); 7. printf("length = %.2f ", length); 8. printf ("height = %.2f ", height); 9. area = width * length; 10. printf ("The area is %.2f watts ", area); 11. volume = width * length * height; 12. printf ("The volume is %.2f watts ", volume); 13. return 0; } Figure 4: C program Rewrite the program so that it will contain the following functions by including the declaration, function definition and function call. Show_info() that execute the lines 5-8 of the program. Calculate_area() that execute the lines 9 and 10. Calculate_volume() that execute line 11-12

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!