Wednesday, October 16, 2019

23. Qbasic program to get radius of circle and then print its area and circumference.


23.      Write a program using FUNCTION…END FUNCTION to get radius of circle and then print its area and circumference.

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

FUNCTION AREA (R)
AREA = 3.14 * R ^ 2
END FUNCTION

FUNCTION CIRCUM (R)
CIRCUM = 2 * 3.14 * R
END FUNCTION

No comments:

Post a Comment