QBasic Programming

Display area of circle

REM PROGRAM TO DISPLAY AREA OF CIRCLE
CLS
INPUT “ENTER RADIUS”; R
A = 3.14 * R ^ 2
PRINT “AREA OF CIRCLE ”; A
END

USING SUB PROCEDURE

DECLARE SUB AREA (R)
CLS
INPUT “ENTER RADIUS”; R
CALL AREA(R)
END

SUB AREA (R)
A = 3.14 * R ^ 2
PRINT “AREA OF CIRCLE ”; A
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION AREA (R)
CLS
INPUT “ENTER RADIUS”; R
AR = AREA(R)
PRINT “AREA OF CIRCLE ”; AR
END

FUNCTION AREA (L, B)
A = 3.14 * R ^ 2
AREA = A
END FUNCTION

Display area of square (Prev Lesson)
(Next Lesson) Display perimeter of rectangle
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!