A Program to Find the Area of a Rectangle

In this example, we are giving a program to find the area of a rectangle. The rule of finding the area of a rectangle is: A = width * height.


Program to find the area of a rectangle:

  1. w = float(input("Enter the value of width: "))
  2. h = float(input("Enter the value of height: "))
  3. area = w * h;
  4. print("Area of rectangle: %.2f"%area)

Output:

Enter the value of width: 3
Enter the value of height: 4
Area of rectangle: 12.00