Python Program to Perform Area of Geometric Shapes. The Result will be displayed on Screen Based on User Choice

Python Program to Perform Area of  Geometric Shapes. The Result will be displayed on Screen Based on User Choice

 


print("1. Area of Circle")

print("2. Area of Square")

print("3. Area of Rectangle")

print("4. Area of Triangle")

print("5. Area of Cube")

choice=int(input("Enter your choice to calculate area of Geometric Shapes:"))

if choice==1:

    r=float(input("Enter radius to calculate area of circle:"))

    C_area=3.14*r*r

    print("The area of Circle is:",C_area)

    

elif choice==2:

    side=float(input("Enter side to calculate area of square:"))

    S_area=side*side

    print("The area of square is:",S_area)

elif choice==3:

    length=float(input("Enter length:"))

    breadth=float(input("Enter breadth:"))

    R_area=length*breadth

    print("The area of rectangle is:",R_area)

elif choice==4:

    base=float(input("Enter base of triangle"))

    height=float(input("Enter height of triangle"))

    T_area=0.5*base*height

    print("The area of triangle is:",T_area)

elif choice==5:

    side=float(input("Enter side of cube:"))

    cube_area= 6*side*side

    print("The area of cube is:",cube_area)

else:

    print("Your choice is invalid! Please enter your choice in 1,2,3,4,5")


Output:

1. Area of Circle

2. Area of Square

3. Area of Rectangle

4. Area of Triangle

5. Area of Cube

Enter your choice to calculate area of Geometric Shapes:5

Enter side of cube:5

The area of cube is: 150.0

टिप्पणी पोस्ट करा

0 टिप्पण्या