Write a program to compute answers to some basic geometry formulas. The program prompts the user to input a length (in centimeters) specified as a floating point value. The program then echoes the input and computes areas of squares and circles and the volume of a cube. For the squares, you will assume that the input length value is the length of a side. For the circles, this same value becomes the diameter. Use the meter value input to calculate the results in square (or cubic) meters and then print the answers in square (or cubic) meters.

Respuesta :

Answer:

import math

l = float(input("Enter length in cm: "))

l = l / 100;

print("Entered length is " + str(l) + " meters")

area_square = l * l

print("Area of square is " + str(area_square))

area_circle =  math.pi * l/2 * l/2

print("Area of circle is " + str(area_circle))

volume_cube =  l * l * l

print("Volume of cube is " + str(volume_cube))

Explanation:

*The code is in Python

Ask the user to enter the length in cm

Convert the length to meters and print it

Calculate the area of the square and print it (Since length is equal to a side, the area is length * length)

Calculate the area of the circle and print it (Since length is equal to the diameter, you need to divide it by two to get the radius. The area is pi * length/2 * length/2)

Calculate the volume of the cube and print it (Since length is equal to a side, the volume is length * length * length)