This is a Java Program to Find the Surface Area and Volume of a Cone.

Formula:

Area=(pi*r*l) + (pi*r*r)

Volume=(1/3)*pi*r*r*h

Formula:

Area=(pi*r*l) + (pi*r*r)

Volume=(1/3)*pi*r*r*h

Enter the radius and height of cone as input. Now we calculate the surface area and volume by using formula and get the desired output.

Here is the source code of the Java Program to Find the Surface Area and Volume of a Cone. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.

import java.util.Scanner;

public class SurfaceArea_Volume

`{`

public static void main(String[] args)

`{`

int r, h;

double l, area, volume, pi = 3.14;

Scanner s = new Scanner(System.in);

System.out.print("Enter the height of cone:");

h = s.nextInt();

System.out.print("Enter the radius of cone:");

r = s.nextInt();

l = Math.sqrt((r * r) + (h * h));

area = (pi * r * l) + (pi * r * r);

System.out.println("Surface Area of cone:"+area);

volume = 0.333 * pi * r * r * h;

System.out.println("Volume of cone:"+volume);

`}`

`}`

Output:

$ javac SurfaceArea_Volume.java $ java SurfaceArea_Volume Enter the height of cone:4 Enter the radius of cone:5 Surface Area of cone:179.02905052769574 Volume of cone:104.56199999999998

**Sanfoundry Global Education & Learning Series – 1000 Java Programs.**

Here’s the list of Best Reference Books in Java Programming, Data Structures and Algorithms.