Volume of Hemisphere
previous NextExample 2
import java.util.Scanner;
class VolumeofHemisphere{
public static void main(String[] args) {
float radius;
float volume;
Scanner sc = new Scanner(System.in);
System.out.print("Enter radius of the hemisphere: ");
radius = sc.nextInt();
volume = (float)((2 * 3.14 * radius)/3);
System.out.println("Volume of hemisphere is :" + volume);
}
}
Output :
Enter radius of the hemisphere: 5 Volume of hemisphere is :10.466666