# Find the surface area of a cone

Here given code implementation process.

``````/*
C Program
Find the surface area of a cone
*/
#include <stdio.h>

#include <math.h>

//Calculate surface area of a cone by given radius and slant height
{
// Formula of cone area
// π * r * s + π * r²
// s is slant_height
//Display given inputs
//Calculate surface area of cone
//Display surface area
printf("\nSurface area of cone %lf\n", area);
}
int main()
{
//Simple Case
cone_surface_area(4.3, 7);
cone_surface_area(5, 8);
cone_surface_area(6.2, 8.3);
return 0;
}``````

#### Output

``````Given Radius : 4.300000 Slant Height 7.000000
Surface area of cone 152.649987

Given Radius : 5.000000 Slant Height 8.000000
Surface area of cone 204.203522

Given Radius : 6.200000 Slant Height 8.300000
Surface area of cone 282.429180``````
``````// Java Program
// Find the surface area of a cone
class Cone
{
//Calculate surface area of a cone by given radius and slant height
public void surface_area(double radius, double slant_height)
{
// Formula of cone area
// π * r * s + π * r²
// s is slant_height
//Display given inputs
System.out.print("\nGiven Radius : " + radius + " Slant Height " + slant_height);
//Calculate surface area of cone
//Display surface area
System.out.print("\nSurface area of cone " + area + "\n");
}
public static void main(String[] args)
{
Cone cone = new Cone();
//Simple Case
cone.surface_area(4.3, 7);
cone.surface_area(5, 8);
cone.surface_area(6.2, 8.3);
}
}``````

#### Output

``````Given Radius : 4.3 Slant Height 7.0
Surface area of cone 152.64998703792804

Given Radius : 5.0 Slant Height 8.0
Surface area of cone 204.20352248333654

Given Radius : 6.2 Slant Height 8.3
Surface area of cone 282.4291795577224``````
``````// C++ Program
// Find the surface area of a cone
#include<iostream>
#include<math.h>
using namespace std;
class Cone
{
public:
//Calculate surface area of a cone by given radius and slant height
{
cout << "\nGiven Radius : " << radius << " Slant Height " << slant_height;
//Calculate surface area of cone
cout << "\nSurface area of cone " << area << "\n";
}
};
int main()
{
Cone cone;
//Simple Case
cone.surface_area(4.3, 7);
cone.surface_area(5, 8);
cone.surface_area(6.2, 8.3);
return 0;
}``````

#### Output

``````Given Radius : 4.3 Slant Height 7
Surface area of cone 152.65

Given Radius : 5 Slant Height 8
Surface area of cone 204.204

Given Radius : 6.2 Slant Height 8.3
Surface area of cone 282.429``````
``````// C# Program
// Find the surface area of a cone
using System;
class Cone
{
//Calculate surface area of a cone by given radius and slant height
public void surface_area(double radius, double slant_height)
{
Console.Write("\nGiven Radius : " + radius + " Slant Height " + slant_height);
//Calculate surface area of cone
Console.Write("\nSurface area of cone " + area + "\n");
}
public static void Main(String[] args)
{
Cone cone = new Cone();
//Simple Case
cone.surface_area(4.3, 7);
cone.surface_area(5, 8);
cone.surface_area(6.2, 8.3);
}
}``````

#### Output

``````Given Radius : 4.3 Slant Height 7
Surface area of cone 152.649987037928

Given Radius : 5 Slant Height 8
Surface area of cone 204.203522483337

Given Radius : 6.2 Slant Height 8.3
Surface area of cone 282.429179557722``````
``````<?php
// Php Program
// Find the surface area of a cone
class Cone
{
//Calculate surface area of a cone by given radius and slant height
{
//Calculate surface area of cone
echo "\nSurface area of cone ". \$area ."\n";
}
}

function main()
{
\$cone = new Cone();
//Simple Case
\$cone->surface_area(4.3, 7);
\$cone->surface_area(5, 8);
\$cone->surface_area(6.2, 8.3);
}
main();``````

#### Output

``````Given Radius : 4.3 Slant Height 7
Surface area of cone 152.64998703793

Given Radius : 5 Slant Height 8
Surface area of cone 204.20352248334

Given Radius : 6.2 Slant Height 8.3
Surface area of cone 282.42917955772``````
``````// Node Js Program
// Find the surface area of a cone
class Cone
{
//Calculate surface area of a cone by given radius and slant height
{
process.stdout.write("\nGiven Radius : " + radius + " Slant Height " + slant_height);
//Calculate surface area of cone
process.stdout.write("\nSurface area of cone " + area + "\n");
}
}

function main()
{
var cone = new Cone();
//Simple Case
cone.surface_area(4.3, 7);
cone.surface_area(5, 8);
cone.surface_area(6.2, 8.3);
}
main();``````

#### Output

``````Given Radius : 4.3 Slant Height 7
Surface area of cone 152.64998703792804

Given Radius : 5 Slant Height 8
Surface area of cone 204.20352248333654

Given Radius : 6.2 Slant Height 8.3
Surface area of cone 282.4291795577224``````
``````#  Python 3 Program
#  Find the surface area of a cone

import math

class Cone :
# Calculate surface area of a cone by given radius and slant height
print("\nGiven Radius : ", radius ," Slant Height ", slant_height, end = "")
# Calculate surface area of cone
print("\nSurface area of cone ", area ,"\n", end = "")

def main() :
cone = Cone()
# Simple Case
cone.surface_area(4.3, 7)
cone.surface_area(5, 8)
cone.surface_area(6.2, 8.3)

if __name__ == "__main__": main()``````

#### Output

``````Given Radius :  4.3  Slant Height  7
Surface area of cone  152.64998703792804

Given Radius :  5  Slant Height  8
Surface area of cone  204.20352248333654

Given Radius :  6.2  Slant Height  8.3
Surface area of cone  282.4291795577224``````
``````#  Ruby Program
#  Find the surface area of a cone
class Cone

# Calculate surface area of a cone by given radius and slant height

#  Formula of cone area
#  π * r * s + π * r²
#  s is slant_height
# Display given inputs
# Calculate surface area of cone
# Display surface area
print("\nSurface area of cone ", area ,"\n")
end
end
def main()

cone = Cone.new()
# Simple Case
cone.surface_area(4.3, 7)
cone.surface_area(5, 8)
cone.surface_area(6.2, 8.3)
end
main()``````

#### Output

``````Given Radius : 4.3 Slant Height 7
Surface area of cone 152.64998703792804

Given Radius : 5 Slant Height 8
Surface area of cone 204.20352248333654

Given Radius : 6.2 Slant Height 8.3
Surface area of cone 282.4291795577224
``````
``````// Scala Program
// Find the surface area of a cone
class Cone
{
//Calculate surface area of a cone by given radius and slant height
def surface_area(radius: Double, slant_height: Double): Unit = {
// Formula of cone area
// π * r * s + π * r²
// s is slant_height
//Display given inputs
print("\nGiven Radius : " + radius + " Slant Height " + slant_height);
//Calculate surface area of cone
//Display surface area
print("\nSurface area of cone " + area + "\n");
}
}
object Main
{
def main(args: Array[String]): Unit = {
var cone: Cone = new Cone();
//Simple Case
cone.surface_area(4.3, 7);
cone.surface_area(5, 8);
cone.surface_area(6.2, 8.3);
}
}``````

#### Output

``````Given Radius : 4.3 Slant Height 7.0
Surface area of cone 152.64998703792804

Given Radius : 5.0 Slant Height 8.0
Surface area of cone 204.20352248333654

Given Radius : 6.2 Slant Height 8.3
Surface area of cone 282.4291795577224``````
``````// Swift Program
// Find the surface area of a cone
import Foundation
class Cone
{
//Calculate surface area of a cone by given radius and slant height
func surface_area(_ radius: Double, _ slant_height: Double)
{
print("\nGiven Radius : ", radius ," Slant Height ", slant_height, terminator: "");
//Calculate surface area of cone
print("\nSurface area of cone ", area ,"\n", terminator: "");
}
}
func main()
{
let cone: Cone? = Cone();
//Simple Case
cone!.surface_area(4.3, 7);
cone!.surface_area(5, 8);
cone!.surface_area(6.2, 8.3);
}
main();``````

#### Output

``````Given Radius :  4.3  Slant Height  7.0
Surface area of cone  152.649987037928

Given Radius :  5.0  Slant Height  8.0
Surface area of cone  204.203522483337

Given Radius :  6.2  Slant Height  8.3
Surface area of cone  282.429179557722`````` ## Comment

Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.