Question
calculate the volume of cone.
Share code with your friends
Share on whatsapp
Share on facebook
Share on twitter
Share on telegram
Code
import java.util.Scanner;
public class volumeOfCone
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter radius of sphere");
double radius=sc.nextDouble();
System.out.println("Enter height of sphere");
double height=sc.nextDouble();
double pie=22/7;
double volume=pie*(radius*radius)*height/3;
System.out.println("Volume of the cone="+volume);
}
}