Write a algorithm, draw a flowchart and write a program in Java to find out the volume of the cylinder and display the result (v = pie r2 h). Also write the variable list
Answers
Answered by
3
Answer:
Algorithm
- Define the height of the cylinder.
- Define the radius of the cylinder.
- Calculate the volume of the cylinder pie x r2 x h
- Define volume_cylinder and assign the volume of the cylinder to it.
Program:
public class cylinder
{
public static void main(String args[])
{
int height=38;
int radius=35;
double pie=3.14285714286;
double volume=pie*(radius*radius)*height;
System.out.println("Volume of the cylinder="+volume);
}
}
Output:
Volume of the cylinder = 146300.000000133
Similar questions