The program calculates the area of a trapezoid based on the given values of its height and the lengths of its two bases. The program first initializes two variables b1 and b2 with the values 5 and 6, respectively. Then, it prompts the user to enter the height of the trapezoid and the lengths of its two bases through the standard input using the input() function. These values are stored in the variables hgt, b1, and b2, respectively.
Next, the program calculates the area of the trapezoid using the formula area = ((b1 + b2) / 2) * hgt and stores the result in the variable area. Finally, the program outputs the calculated area using the print() function.
b1 = 5 b2 = 6 hgt = float(input("Enter Height of Trapezoid: ")) b1 = float(input("Enter the Base 1 Value :")) b2 = float(input("Enter the Base 2 Value :")) area = ((b1 + b2) / 2) * hgt print("Area : ", area)
Enter Height of Trapezoid: 2 Enter the Base 1 Value :3 Enter the Base 2 Value :2 Area : 5.0
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions