Computer Science, asked by avikroychoudhury628, 2 months ago

How to draw a shape in QBasic?​

Answers

Answered by BrycenCabitac
1

Answer:

REM PROGRAM TO DISPLAY SQUARE OF AN INPUT NUMBER

CLS

INPUT “ENTER ANY NUMBER”; N

S = N ^ 2

PRINT “SQUARE OF NUMBER ”; S

END

USING SUB PROCEDURE

DECLARE SUB SQUARE (N)

CLS

INPUT “ENTER ANY NUMBER”; N

CALL SQUARE(N)

END

SUB SQUARE (N)

S = N ^ 2

PRINT “SQUARE OF NUMBER “; S

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION SQUARE (N)

CLS

INPUT “ENTER ANY NUMBER”; N

S = SQUARE(N)

PRINT “SQUARE OF NUMBER “; S

END

FUNCTION SQUARE (N)

SQ= N ^ 2

SQUARE = SQ

END FUNCTION

For rectangle:

This program is used for draw boxes with Line segment.

          SCREEN 7

          COLOR5,15

          CLS

          LINE(60,60)-(130,100),6,B

          The letter B indicates the box option.In this statement,the coordinates (60,60) and                         (130,100) are the opposite corners of the rectangle.

          To fill the box with the desired colour shade,add BF(box fill) option.

         

           SCREEN 7

           COLOR5,15

           CLS

           PRINT "This is a Rectangle"

           LINE(60,60)-(130,100),6,BF

Explanation:

Similar questions