Write a QBASIC program to input length and breadth of a rectangle, calculate area and display on screen.
Answers
Answered by
11
Solution:
The given code is written in QBASIC.
CLS
INPUT "Enter length: "; L
INPUT "Enter breadth: "; B
AREA = L * B
PRINT "Area is:"; AREA
END
Explanation:
- Line 1: Clear the screen.
- Line 2 and 3: Take length and breadth as input from the user.
- Line 4: Calculate area using formula.
- Line 5: Display the of the rectangle.
- Line 6: End the program.
See the attachment for output.
Attachments:
Answered by
6
Answer:
CLS
INPUT "ENTER LENGTH AND BREADTH";L,B
AREA=L*B
PRINT "AREA";AREA
END
Logic:-
- Accept length and breadth as input
- calculate area
- display area
Similar questions