C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Program to find the surface area of the sphere
The sphere can be defined as the round 3D object having a string of points located at a uniform distance from a particular point called center. It is perfectly symmetrical and has no edges or vertices. A sphere with radius r has a volume of (4/3) x pie x radius2 and a surface area of 4 x pie x r2. FormulaSurface area of sphere = 4 x pie x r2 Algorithm
ComplexityO(1) SolutionC Program#include Output: Surface area of the sphere=17210.285714 PHP Program
<?php
$radius=37;
$pie=3.14285714286;
$surface_area=4*$pie*($radius*$radius);
echo "Surface area of sphere=";
echo $surface_area;
?>
Output: Surface area of sphere=17210.285714301 Java Program
public class shpere{
public static void main(String args[])
{
int radius=37;
double pie=3.14285714286;
double area_sphere=4*pie*(radius*radius);
System.out.println("Surface area of sphere="+area_sphere);
}
}
Output: Surface area of sphere=17210.28571430136 C# Program
using System;
public class Program
{
public static void Main()
{
int radius=37;
double pie=3.14285714286;
double area_sphere=4*pie*(radius*radius);
Console.WriteLine("Surface area of sphere="+area_sphere);
}
}
Output: Surface area of sphere=17210.2857143014 Python Program
radius=37
pie=3.14285714286
area_sphere=4*pie*(radius*radius)
print("Surface area of the sphere="+str(area_sphere))
Output: Surface area of the sphere=17210.28571430136
Next Topic#
|