Array-promo

Question

calculate the volume of a cylinder.

Share code with your friends

Share on whatsapp
Share on facebook
Share on twitter
Share on telegram

Code

				
					import java.util.Scanner;
public class volumeOfCylinder
{  
    public static void main(String args[])  
    {  
        Scanner sc=new Scanner(System.in);
        System.out.println("Enter radius of cylinder");
        double radius=sc.nextDouble();
        System.out.println("Enter height of cylinder");
        double height=sc.nextDouble();
        double pi=22/7;  
    
        double volume=pi*(radius*radius)*height;  
        System.out.println("Volume of the cylinder="+volume);  
    }  
} 
 

				
			

Coding Store

Leave a Reply

Your email address will not be published. Required fields are marked *