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;
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 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
This comment has been removed by the author.
ReplyDelete