196k views
3 votes
The length, height, and width of a cube are 10, 7, and 5 cm respectively. Write a program that calculates the volume, perimeter, and surface area of the cube. This problem has 5 points.

1 Answer

5 votes

Answer:

// code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variables

int length=10,height=7,width=5;

// find the volume of

int vol=length*height*width;

// find the surface area

int sa=2*(length*width+length*height+height*width);

// find the perimeter

int peri=4*(length+width+height);

// print the volume

cout<<"Volume is: "<<vol<<" cm^3."<<endl;

// print the surface area

cout<<"Surface area is: "<<sa<<" cm^2."<<endl;

// print the perimeter

cout<<"Perimeter is: "<<peri<<" cm."<<endl;

return 0;

}

Step-by-step explanation:

Declare and initialize length=10, width=5 and height=7.calculate volume by multiply length, width and height and assign to variable "vol".Then find the surface area as 2*(length*width+length*height+height*width) and assign it to variable "sa".Then find the perimeter as 4*(length+width+height) and assign to variable "peri". Print the volume, perimeter and surface area.

Output:

Volume is: 350 cm^3.

Surface area is: 310 cm^2.

Perimeter is: 88 cm.

User Richard Bonneau
by
6.8k points