Pages

Thursday, July 04, 2013

Write a program to find Volume of a Box in C++

Write a program to find the Volume of a box.
      A = w * h;    Volume of a box: l × w × h

Input:


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
   #include <iostream.h>
   #include <conio.h>
   int main()
   {
   cout << "Volume of a box Formula: V = l * w * h \n";
   float A, w, l, h, V;
   cout << "Enter the value of l <length>?\n";
   cin  >> l;
   cout << "Enter the value of w <Width>?\n";
   cin  >> w;
   cout << "Enter the value of h <height>?\n";
   cin  >> h;
     A  = w * h;
     V  = A * l;
   cout <<"\t\"THE VOLUME OF box\" = "<< V << " m^3 " << endl;
   getch();
   return 0;
            }

Output:


Volume of a box Formula: V = l * w * h
Enter the value of l <length>?
24
Enter the value of w <Width>?
45
Enter the value of h <height>?
67
 "THE VOLUME OF box" = 72360 m^3 


No comments:

Post a Comment