C++ Exercises
C++ Program to calculate the volume and surface of the Cones.
Let see the program to calculate the volume and surface of the Cones.
/* to calculate the volume of the Cones. */ #include <iostream> using namespace std; int main() { float radius,height,volume; cout<<"Enter radius of Cones :"; cin>>radius; cout<<"Enter height of Cones :"; cin>>height; volume=(1/3)*(22/7)*radius*radius*height; cout<<"volume of Cones = :"<<volume<<" units."<<endl; return 0; }
Output:
Enter radius of surface :2 Enter height of surface :3 volume of surface = :12.57142857142857 units.
/* to calculate the surface of the Cones. */ #include <iostream> using namespace std; #include <math.h> int main() { float radius,height,volume; cout<<"Enter radius of Cones :"; cin>>radius; cout<<"Enter height of Cones :"; cin>>height; volume=(22/7)*radius*radius+(22/7)*radius*(sqrt(radius*radius+height*height)); cout<<"Surface of Cones = :"<<volume<<" sq. units."<<endl; return 0; }
Output:
Enter radius of Cones :1 Enter height of Cones :2 Surface of Cones = :9.7082 sq. units.