To find the grade of a student using SELECT CASE. (Qbasic Code)

  • To find the grade of a student using SELECT CASE. (Qbasic Code)
CLS
INPUT "Enter the Marks Scored"; m
SELECT CASE m
    CASE IS >= 90
        PRINT "Your Grade is A+"
    CASE IS >= 80
        PRINT "Your Grade is A"
    CASE IS >= 70
        PRINT "Your Grade is B+"
    CASE IS >= 60
        PRINT "Your Grade is B"
    CASE IS >= 50
        PRINT "Your Grade is C+"
    CASE IS >= 40
        PRINT "Your Grade is C"
    CASE IS >= 32
        PRINT "Your Grade is D"
    CASE ELSE
        PRINT "Your Grade is E"
END SELECT
END


Alternate Method
CLS
INPUT "Enter the Marks Scored"; m
SELECT CASE m
    CASE 90 TO 100
        PRINT "Your Grade is A+"
    CASE 80 TO 89
        PRINT "Your Grade is A"
    CASE 70 TO 79
        PRINT "Your Grade is B+"
    CASE 60 TO 69
        PRINT "Your Grade is B"
    CASE 50 TO 59
        PRINT "Your Grade is C+"
    CASE 40 TO 49
        PRINT "Your Grade is C"
    CASE 32 TO 39
        PRINT "Your Grade is D"
    CASE ELSE
        PRINT "Your Grade is E"
END SELECT
END

Share :

Twitter
Back To Top

facebook main

counter

Powered by Blogger.