Mary Needs To Write A Program To Calculate The Volume Of The Cylinder. To Calculate The Volume Of The Cylinder,Mary Needs To Use The Following Formula
Volume =
π
r
2h
π
r
Here, r is the radius of the cylinder, h is the height of the cylinder and the value of pie is 3.14. Help Mary To Perform Desired Task.
Answer:-
public class VolumeOfTheCylinder
{
public static void main(String[] args)
{
int r, h;
double volume;
r = 6;
h = 15;
volume = 3.14 * r* r*h;
System.out.println("----------------------------------------");
System.out.println("Volume ="+volume);
System.out.println("----------------------------------------");
}
}
No comments:
Post a Comment