The length height and width of a cube are 10 7 and 5 cm resp

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.

Solution

% MATLAB Program to calculate Volume, Perimeter and Surface area of a cube
% Length in cm
L = 10;
% Height in cm
H = 7;
% Width in cm
W = 5;
% Calculation of Volume (in cm^3)
V = L*H*W;
fprintf(\'Cube Volume = %i\ \',V);
% Calculation of Perimeter (in cm)
P = 4*(L+H+W);
fprintf(\'Cube Perimeter = %i\ \',P);
% Calculation of Surface Area (in cm^2)
A = 2*(L*H+H*W+W*L);
fprintf(\'Cube Surface Area = %i\ \',A);

 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.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site