-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDimension.java
More file actions
23 lines (23 loc) · 931 Bytes
/
Dimension.java
File metadata and controls
23 lines (23 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//Question 5
import java.util.*;
class Dimension{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.println("Enter the side of a cube: ");
int a=sc.nextInt();
System.out.println("Enter the radius of a cone: ");
int r=sc.nextInt();
System.out.println("Enter the height of a cone: ");
int h=sc.nextInt();
System.out.println("Enter the radius of a sphere: ");
int s=sc.nextInt();
System.out.println("Enter the radius of a cylinder: ");
int p=sc.nextInt();
System.out.println("Enter the heigth of a cylinder: ");
int k=sc.nextInt();
System.out.println("The volume of cube: "+(a*a*a));
System.out.println("The volume of cone: "+((r*r*h)/3));
System.out.println("The volume of sphere: "+(s*s*s));
System.out.println("The volume of cylinder : "+(p*p*k));
}
}