Tuesday, 16 January 2018

Core Java Practice Problem

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

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

Error While embed the video in Your website page

Error:- Refused to display '<URL>' in a frame because it set 'X-Frame-Options' to 'sameorigin Solution:- if ...