QBASIC – Area of square

Below is the QBASIC program to calculate the area of a square.

' Program to find area of square
CLS
INPUT "Enter the length: "; l
area = l * l
PRINT "Area of the square is: ";area
END

Explanation:

Let’s first see the formula: Area = length * length or Area = length ^ 2. So, we can determine the area of a square by taking the length of the square from the user and multiplying the length by itself or calculating the square of the length since, unlike rectangles, squares have equal length.

Leave a Comment

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