Computer Science, asked by rj8632284, 2 months ago

write a program in QBASIC
To take the side of a square from the user as input and find the area and perimeter of a square​

Answers

Answered by anindyaadhikari13
8

\texttt{\textsf{\large{\underline{Solution}:}}}

The given co‎‎de is written in QBASIC.

CLS

INPUT "Enter side of the square: "; A

PERIMETER = 4 * A

AREA = A ^ 2

PRINT "Perimeter of the square is: "; PERIMETER

PRINT "Area of the square is: "; AREA

END

\texttt{\textsf{\large{\underline{Explanation}:}}}

  • Line 1: Clears the screen.
  • Line 2: Takes the side of the square as input.
  • Line 3: Calculate perimeter of the square using formula.
  • Line 4: Calculate area of the square using formula.
  • Line 5: Displays the perimeter of the square.
  • Line 6: Displays the area of the square.
  • Line 7: End of program.

See the attachment for output.

Attachments:
Similar questions