write a program which calculates the surface area and volume of a cylinder
AlizaFarooqui:
please answer fast
Answers
Answered by
5
import java.util.*;
class cylinder
{public static void main()
{
Scanner sc= new Scanner(System.in);
System.out.println("Enter the radius of the cylinder");
double r=sc.nextDouble();
System.out.println("Enter the height of the cylinder");
double h=sc.nextDouble();
double pi=3.14;
double v=pi*r*r*h;
double sa=(2*pi*r*h)+(2*pi*r*r);
System.out.println("The volume of the cylinder is "+v);
System.out.println("The surface area of the cylinder is "+sa);
}
}
Similar questions