Java Program to Find Volume and Surface Area of Cuboid

bookmark

class Main
{
    public static void main(String [] args)
    {
        //length, breadth, height value declared
        int l = 1;
        int b = 2;
        int h = 3;
        //find volume
        double vol =  l*b*h;
        //find area
        double area = 2*((l*b) + (b*h) + (h*l));
        System.out.println("The volume of cuboid is: " + vol);
        System.out.println("The area of cuboid is: " + area);
    }
}

 


Output:

The volume of cuboid is: 6.0
The area of cuboid is: 22.0