Computer Science, asked by kartiksharma89, 10 months ago

2. Write a program to input length, breadth and height of a cuboid and then calculate its
volume. (Volume of cuboid = length*breadth* height)
answer done in python​

Answers

Answered by chiks639
14

Answer:

# Python Program to find Volume and Surface Area of Cuboid

length = float(input('Please Enter the Length of a Cuboid: '))

width = float(input('Please Enter the Width of a Cuboid: '))

height = float(input('Please Enter the Height of a Cuboid: '))

# Calculate the Surface Area

SA = 2 * (length * width + length * height + width * height)

# Calculate the Volume

Volume = length * width * height

# Calculate the Lateral Surface Area

LSA = 2 * height * (length + width)

print("\n The Surface Area of a Cuboid = %.2f " %SA)

print(" The Volume of a Cuboid = %.2f" %Volume);

print(" The Lateral Surface Area of a Cuboid = %.2f " %LSA)

Explanation:

ANALYSIS

Below statements will ask the user to enter length, width and height values and it will assign the user input values to respected variables. Such as first value will be assigned to length, second value to width and third value will be assigned to height

______________________________________________________

length = float(input('Please Enter the Length of a Cuboid: '))

width = float(input('Please Enter the Width of a Cuboid: '))

height = float(input('Please Enter the Height of a Cuboid: '))

______________________________________________________

Next, We are calculating Volume, Surface Area and Lateral

Surface Area of a Cuboid using their respective Formulas:

______________________________________________________

# Calculate the Surface Area

SA = 2 * (length * width + length * height + width * height)

# Calculate the Volume

Volume = length * width * height

# Calculate the Lateral Surface Area

LSA = 2 * height * (length + width)

Following print statements will help us to print the Volume and Surface area of a Cuboid

print("\n The Surface Area of a Cuboid = %.2f " %SA)

print(" The Volume of a Cuboid = %.2f" %Volume);

print(" The Lateral Surface Area of a Cuboid = %.2f " %LSA)

What answer will come please tell us

Thank you

Answered by Suppriyo
24

Answer:

import java.util.*;

class volume

{

public static void main()

{

int l,b,h,v;

System.out.println("Enter length");

l=sc.nextInt();

System.out.println("Enter breadth");

b=sc.nextInt();

System.out.println("Enter height");

h=sc.nextInt();

v=l*b*h;

System.out.println("the volume is:" + v);

}

}

Similar questions