Computer Science, asked by worldtks, 1 year ago

Write a program in qbasic to draw a tree with two triangles(one after the other)for leaves and a rectangle for the stem.Pls color the tree after the program

Answers

Answered by Anonymous
0
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

Similar questions