QBasic Programming

Display sum of square of any two input numbers

REM PROGRAM TO DISPLAY SUM OF SQUARE OF ANY TWO INPUT NUMBERS
CLS
INPUT “ENTER FIRST NUMBER”; A
INPUT “ENTER SECOND NUMBER”; B
S = A ^ 2 + B ^ 2
PRINT “SUM OF SQUARE OF TWO NUMBERS ”; S
END

USING SUB PROCEDURE

DECLARE SUB SQUARE (A, B)
CLS
INPUT “ENTER FIRST NUMBER”; A
INPUT “ENTER SECOND NUMBER”; B
CALL SQUARE(A, B)
END

SUB SQUARE (A, B)
S = A ^ 2 + B ^ 2
PRINT “SUM OF SQUARE OF TWO NUMBERS “; S
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION SQUARE (A, B)
CLS
INPUT “ENTER FIRST NUMBER”; A
INPUT “ENTER SECOND NUMBER”; B
S = SQUARE(A, B)
PRINT “SUM OF SQUARE OF TWO NUMBERS “; S
END

FUNCTION SQUARE (N)
SQ= A ^ 2 + B ^ 2
SQUARE = SQ
END FUNCTION

Display cube root of an input number (Prev Lesson)
(Next Lesson) Display sum of cube of any two input numbers
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 !!