Â
In this, we are going to see how to find Total Surface Area of Cuboid using C++ program.
The formula to calculate is,
Total Surface Area of Cuboid = 2*(length*width + width*height + height*length)Â
The Code given below can be used in Turbo C++ Compiler.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float area, length, width, height;
cout<<"This program is for Total Surface Area of Cuboid\n";
cout<<"Enter the length, width and height of the Cuboid\n";
cin>>length>>width>>height;
//formula for Total Surface Area of Cuboid is 2*(length*width + width*height + height*length)
area = 2*((length*width) + (width*height) + (height*length));
cout<<"The Total Surface Area of Cuboid with lenght "<<length<<", width "<<width<<" and height "<<height<<" is = "<<area<<" sq units";
getch();
}
The Code given below can be used in g++/gcc Compiler.
#include<iostream>
using namespace std;
int main()
{
float area, length, width, height;
cout<<"This program is for Total Surface Area of Cuboid\n";
cout<<"Enter the length, width and height of the Cuboid\n";
cin>>length>>width>>height;
//formula for Total Surface Area of Cuboid is 2*(length*width + width*height + height*length)
area = 2*((length*width) + (width*height) + (height*length));
cout<<"The Total Surface Area of Cuboid with lenght "<<length<<", width "<<width<<" and height "<<height<<" is = "<<area<<" sq units";
return 0;
}
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP