Psychology, asked by hirajender, 9 months ago

You can draw a square or a rectangle using .......... command in QBASIC.

Answers

Answered by Anonymous
4

Answer:

using line command in QBSIC you can draw a square or rectangle

Answered by harshchoudhary3113
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

pls mark as brainliest

Similar questions