How to make a QBASIC program to find GPA using ELSE IF and SELECT CASE statement
A QBASIC program to find GPA using ELSE IF statement
What is QBASIC ?
QBASIC is most popular high level programming language develop in Dartmouth college USA,by mathematicians John George Kemeny and Tom Kurtzas in the year of 1963 as named BASIC and after that Microsoft buy it and changed its name as QBASIC.
For more information and downloads click in the below link
QB64.org
The home of QB64, a QuickBASIC/QBasic compatible programming language for modern computers.
WAP TO FIND GPA IS BELOW
DIM p AS INTEGER
DIM g AS STRING
DIM gpa AS INTEGER
DIM r AS STRING
CLS
INPUT "enter your percentage"; p
IF p >= 90 AND p < 100 THEN
g = "A+"
gpa = 4
r = "outstanding"
ELSEIF p >= 80 AND p < 90 THEN
g = "A"
gpa = 3.6
r = "Excellent"
ELSEIF p >= 70 AND p < 80 THEN
g = "B+"
gpa = 3.2
r = "very good"
ELSEIF p >= 60 AND p < 70 THEN
g = "B"
gpa = 2.8
r = "Good"
ELSEIF p >= 50 AND p < 60 THEN
g = "C+"
gpa = 2.4
r = "Satisfactandy"
ELSEIF p >= 40 AND p < 50 THEN
g = "C"
gpa = 2.0
r = "Acceptable"
ELSEIF p >= 30 AND p < 40 THEN
g = "D+"
gpa = 1.6
r = "Partially Acceptable"
ELSEIF p >= 20 AND p < 30 THEN
g = "D"
gpa = 1.2
r = "Insufficient"
ELSEIF p >= 0 AND p < p THEN
g = "E"
gpa = 0.8
r = "Very Insufficient"
END IF
PRINT "Your grade is", g
PRINT "Your gpa is"; gpa
PRINT "about you "; r
END
OR
A QBASIC program to find GPA using SELECT CASE statement
REM A QBASIC PROGRAM TO FIND GRADE
DIM percentage AS INTEGER
DIM GPA AS INTEGER
DIM grade AS STRING
DIM Description AS STRING
CLS
top:
INPUT "Please Enter Student's percentage"; percentage
SELECT CASE percentage
CASE 90 TO 100
grade = "A+"
GPA = 4.0
Description = "Outstanding"
CASE 80 TO 90
grade = "A"
GPA = 3.6
Description = "Excellent"
CASE 70 TO 80
grade = "B+"
GPA = 3.2
Description = "Very Good"
CASE 60 TO 70
grade = "B"
GPA = 2.8
Description = "Good'"
CASE 50 TO 60
grade = "C+"
GPA = 2.4
Description = "Satisfactory"
CASE 40 TO 50
grade = "C"
GPA = 2.0
Description = "Acceptable"
CASE 30 TO 40
grade = "D+"
GPA = 1.6
Description = "Partially Acceptable"
CASE 20 TO 30
grade = "D"
GPA = 1.2
Description = "Insufficientt"
CASE 0 TO 20
grade = "E"
GPA = 0.8
Description = " Very Insufficient"
CASE ELSE
grade = "Invalid Percentage:NO entery"
END SELECT
PRINT "The Student's Grade Is: "; grade
PRINT "The student's GPA is :"; GPA
PRINT "About the Student:"; Description
INPUT "Do you want to check anymore ?ifyes then type y....."; y$
IF y$ = "y" OR y$ = "Y" THEN GOTO top
END
copy above code and paste in your QBASIC compiler and press f5 or fn+f5 it will run then find out your result
SHARE
0 Komentar
Post a Comment