QBasic Programming

Display square root of an input number

REM PROGRAM TO DISPLAY SQUARE ROOT OF AN INPUT NUMBER
CLS
INPUT “ENTER ANY NUMBER”; N
S = N ^ (1 / 2)
PRINT “SQUARE ROOT OF NUMBER ”; S
END

USING SUB PROCEDURE

DECLARE SUB SQROOT (N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL SQROOT(N)
END

SUB SQROOT (N)
S = N ^ (1 / 2)
PRINT “SQUARE ROOT OF NUMBER “; S
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION SQROOT (N)
CLS
INPUT “ENTER ANY NUMBER”; N
S = SQROOT(N)
PRINT “SQUARE ROOT OF NUMBER “; S
END

FUNCTION SQROOT (N)
SQ= N ^ (1 / 2)
SQROOT = SQ
END FUNCTION

Display cube of an input number (Prev Lesson)
(Next Lesson) Display cube root of an input number
Back to QBasic Programming
Notice: compact(): Undefined variable: limits in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

Notice: compact(): Undefined variable: groupby in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!