Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

image text in transcribed

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

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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

Consider this article:...

Answered: 1 week ago