Question: Write a program to calculate the cost of making a rectangular steel box. The program should read in the desired length l_box, the width w_box,
Write a program to calculate the cost of making a rectangular steel box. The program should read in the desired length l_box, the width w_box, and the height h_box, and the cost in Euro per square centimetres of steel, c. Assume that there is 2% wastage in the manufacturing process (in other words, the amount of steel needed is 2% more than the actual surface area of the box). The program should print the total cost in Euro of manufacturing the steel box, and the wastage cost in Euro associated with this box.
Make sure that all length, height, width and cost are larger than 0. Print the error message "Values must be larger than 0" otherwise. See the example.
Hint: to read properly the input with scanf, you have to respect the specific format of the input which is in this case "length=%d height=%d width=%d cost=%d"
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
