Computer Science, asked by pplay24181, 8 months ago

Q6. Write a program in qbasic input two numbers and find the square of greatest and cube of smallest

Answers

Answered by soni333722
0

Answer:

7. Display square of an input number.

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

Similar questions