how to do square in qbasic
Answers
Answered by
2
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
Answered by
1
Rame Program To Display Square of An Input Numberclsinput "Enter Any Number"; NS= N^ 2 Print "Square of Number"; Send using sub Procedure. Function Square (N) SQ = N^2 Square = SQ End Function.❤
Similar questions
CBSE BOARD X,
1 month ago
Math,
1 month ago
Political Science,
1 month ago
Physics,
2 months ago
Chemistry,
9 months ago
Math,
9 months ago