To input radius of a circle and allows user to choose to find the area or perimeter of the circle. (Qbasic Code)

To input radius of a circle and allows user to choose to find the area or perimeter of the circle. (Qbasic Code)
  • CLS
    INPUT "Enter the radius of the circle"; r
    PRINT
    PRINT "To find the area, Press 1"
    PRINT "To find the perimeter, Press 2"
    PRINT
    INPUT "Which do you want to find"; ch
    PRINT
    pi = 3.14
    IF ch = 1 THEN
        a = pi * r ^ 2
        PRINT "Area of the circle is"; a
    ELSEIF ch = 2 THEN
        p = 2 * pi * r
        PRINT "Perimeter of the circle is"; p
    ELSE
        PRINT "Selection Wrong";
    END IF
    END

Share :

Twitter
Back To Top

facebook main

counter

Powered by Blogger.