Computer Science, asked by chenxiang, 9 months ago

1 ) WAP to calculate the area of -
a) rectangle by entering length and width.
b) triangle by entering hieght and base.
*these are for python

Answers

Answered by Tejas1582
0

Answer:

print("Area calculator /n 1.Rectangle /n 2.Triangle")

opt = int(input("Enter option"))

if(opt ==1):

l = input("Enter length")

b= input("Enter breadth")

A = l * b

print("Area is ",A)

else :

h = input ("Enter height")

b = input ("Enter breadth")

A = 0.5 * h * b

print("The area is",A)

Answered by anindyaadhikari13
1

Question:-

WAP to calculate the area of:-

  1. Rectangle by entering length and breadth.
  2. Triangle by entering the height and base.

Program:-

This is written in Python.

print("1. Rectangle Area. \n2.Triangle Area. ")

ch=int(input("Enter Choice: "))

if ch==1:

a=int(input("Enter length: "))

b=int(input("Enter breadth: "))

print("Area is: ",a*b)

elif ch==2:

h=int(input("Enter height: "))

b=int(input("Enter base: "))

c=0.5*h*b

print("Area is: ",c)

else:

print("Wrong input. ")

Similar questions