write a program in Q Basic to find the area and perimeter of a rectangle whose length is nothing
Answers
Answered by
5
- write a program in QBASIC to find the area and perimeter of a rectangle.
The given problem is solved using language - QBASIC.
CLS
INPUT "Enter the length of the rectangle: "; L
INPUT "Enter the breadth of the rectangle: "; B
P = 2 * (L + B)
A = L * B
PRINT "Perimeter:"; P; "unit."
PRINT "Area:"; A; "square unit."
END
- Line 1: Clears the screen.
- Line 2-3: Accepts the length and breadth from the user.
- Line 4-5: Calculate the perimeter and area of the rectangle and store them in variables.
- Line 6-7: Display the perimeter and area of the rectangle.
- Line 8: End of program.
See the attachment for output.
Attachments:
Similar questions