C++ Exercises

C++ Program to calculate the volume and surface of the prisms.

Let see the program to calculate the volume and surface of the prisms.

```
Example:

Formula:
Prisms

```
```
/* to calculate the volume of the prisms. */
#include <iostream>

using namespace std;
int main()
{
double base,height,volume;

cout<<"Enter base of prisms :";
cin>>base;
cout<<"Enter height of prisms :";
cin>>height;
volume=base*height;
cout<<"Volume of prisms = :"<<volume<<" units."<<endl;

return 0;
}
```
Output:
```
Enter base of prisms :10
Enter height of prisms :15
Volume of prisms = :150 units.

```
```
/* to calculate the surface of the prisms. */
#include <iostream>

using namespace std;
int main()
{
double base,height,base_perimeter,surface;

cout<<"Enter base of prisms :";
cin>>base;
cout<<"Enter height of prisms :";
cin>>height;
cout<<"Enter base perimeter of prisms :";
cin>>base_perimeter;
surface=2*base+base_perimeter*height;
cout<<"surface of prisms = :"<<surface<<" sq. units."<<endl;

return 0;
}

```
Output:
```
Enter base of prisms :1
Enter height of prisms :2
Enter base perimeter of prisms :3

surface of prisms = :8 sq. units.

```