Â
In this, we are going to see how to find Total Surface Area of Cone using C++ program.
The formula to calculate is,
Total Surface Area of Cone = π * radius * (radius + SlantHeight)
The Code given below can be used in Turbo C++ Compiler.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float area, radius, slant_height, pi=3.142;
cout<<"This program is for Total Surface Area of Cone\n";
cout<<"Enter the radius and slant-height of the cone\n";
cin>>radius>>slant_height;
//formula for Total Surface Area of Cone is π*radius*(radius + slantheight)
area = pi*radius*(radius+ slant_height);
cout<<"The Total Surface Area of Cone with radius "<<radius<<" and slant-height "<<slant_height<<" is = "<<area<<" sq units";
getch();
}
The Code given below can be used in g++/gcc Compiler.
#include<iostream>
using namespace std;
int main()
{
float area, radius, slant_height, pi=3.142;
cout<<"This program is for Total Surface Area of Cone\n";
cout<<"Enter the radius and slant-height of the cone\n";
cin>>radius>>slant_height;
//formula for Total Surface Area of Cone is π*radius*(radius + slantheight)
area = pi*radius*(radius+ slant_height);
cout<<"The Total Surface Area of Cone with radius "<<radius<<" and slant-height "<<slant_height<<" is = "<<area<<" sq units";
return 0;
}
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP