Computer Science, asked by 20144694, 17 days ago

WRITE A PROGRAM IN QBASIC TO STORE THE LENGTH AND BREADTH OF A RECTANGLE AND PRINT ITS AREA AND PERIMETER.​

Answers

Answered by anindyaadhikari13
1

Solution:

The given problem is solved in QBASIC.

CLS

INPUT "Enter the length:"; LENGTH

INPUT "Enter the breadth:"; BREADTH

PERIMETER = 2 * (LENGTH + BREADTH)

AREA = LENGTH * BREADTH

PRINT "Perimeter ="; PERIMETER

PRINT "Area ="; AREA

END

Explanation:

  • Line 1: Clears the screen.
  • Line 2: Accepts the length from user.
  • Line 3: Accepts the breadth from user.
  • Line 4: Calculates perimeter using formula P = 2 * (L + B)
  • Line 5: Calculates area using formula A = L * B
  • Line 6: Displays the perimeter of the rectangle.
  • Line 7: Displays the area of the rectangle.
  • Line 8: End of program.

Refer to the attachment for output.

Attachments:

anindyaadhikari13: Thanks for the brainliest ^_^
Answered by dlvarshini282008
0

Answer:

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:
Similar questions