Saturday, 15 October 2016

HHW Q18. WAP to calculate TSA and volume of a Cylinder .

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
long int h,r,a1,a2,v;
cout<<"Enter height of the Cylinder ";
cin>>h;
cout<<"Enter radius of the Cylinder ";
cin>>r;
float const pi=3.14;
v=pi*r*r*h;
a1=2*pi*r*h;
a2=(2*pi*r*r)+(2*pi*r*h);
cout<<"Volume of Cylinder = "<<v<<"\n";
cout<<"TSA of Cylinder = "<<a2<<"\n";
cout<<"CSA of Cylinder = "<<a1<<"\n";
getch();
}

No comments:

Post a Comment

Basic Implementation of Array as a Pointer

#include<iostream.h> #include<conio.h> void main() { clrscr();   int arr[5];   cout<<"Enter 5 nos. ";   f...