QBASIC – Area of 4 walls

Below is the QBASIC program to calculate the area of four walls.

REM Program to find area of four walls
CLS
INPUT "Enter the length: "; l
INPUT "Enter the breadth: "; b
INPUT "Enter the height: "; h
area = 2 * h * (l + b)
PRINT "Area of four walls is: ";area
END

Explanation:

Let’s first see the formula: Area = 2 * h * (l + b). So, we can determine the area of four walls by taking the length, breadth, and height of four walls from the user and multiplying the sum of length and breadth by height times 2.

Leave a Comment

Your email address will not be published. Required fields are marked *