QBasic Programming

Display circumference of circle

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

USING SUB PROCEDURE

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

SUB CIRCUM (R)
C = 2 * 3.14 * R
PRINT “CIRCUMFERENCE OF CIRCLE ”; C
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION CIRCUM (R)
CLS
INPUT “ENTER RADIUS”; R
CR = CIRCUM(R)
PRINT “CIRCUMFERENCE OF CIRCLE ”; CR
END

FUNCTION CIRCUMFERENCE (L, B)
C = 2 * 3.14 * R
CIRCUM  = C
END FUNCTION

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

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!