Monday, October 24, 2022

C++ Problem (7) : How to find the surface area of a cylinder when radius and height of the cylinder are given?

 C++ (7) : How to find the surface area of a cylinder when radius and height of the cylinder are given?

Code:

#include<iostream>
using namespace std;
int main(){
double r,h,a;
cout<<"*****Finding the surface area of a Cylinder.*****"<<endl;

cout<<"Enter the radius."<<endl;
cin>>r;

cout<<"Enter the height."<<endl;
cin>>h;

         a= 2*3.14*r*h+2*3.14*r;

cout<<"The surface area of cylinder having radius "<<r<<" and height "<<h<<"  approximately : "<<a<<endl;
return 0;
}

Output:

*****Finding the surface area of a Cylinder.*****
Enter the radius.
1
Enter the height.
1
The surface area of cylinder having radius 1 and height 1 approximately : 12.56

1 comment:

 How to create a shortcut for a program(application) on windows? Fisrt of all if you are at desktop screen, click right on mouse and click o...