C++ Program to Compute Volume and Surface Area of Cuboid

C++ Program to Compute Volume and Surface Area of Cuboid

Write C++ Program to Compute Volume and Surface Area of Cuboid

// CPP Program to Compute Volume and Surface Area of Cuboid

#include <iostream>

using namespace std;

int main()

{
   float length = 4, breadth = 5, height = 6 ;

   double area_cuboid;
   //cuboid area formula
   area_cuboid = 2 * ((length * breadth) + (breadth * height) + (height * length));

   double volume;
   //cuboid volume formula
   volume = length * breadth * height;

   cout << "Surface area of the cuboid having length " << length << " breadth " << breadth
        << " and height " << height << " is --> " << area_cuboid;

   cout << "\nVolume of the cuboid having length " << length
            << ", breadth " << breadth << " and height " << height << " is --> " << volume;

   return 0;
}

Output:

Surface area of the cuboid having length 4.00, breadth 5.00 and height 6.00 is --> 148.00
Volume of the cuboid having length 4.00  breadth 5.00 and height 6.00 is --> 120.00