QBASIC Programming
Sum of two numbers
CLS
REM To find Sum of two numbers
INPUT “Enter the first number”; a
INPUT “Enter the second number”; b
SUM = a + b
COLOR 5
PRINT TAB(5); “The sum of two number is”; SUM;
END
To find Area of Rectangle
CLS
REM To find Area of Rectangle
INPUT “Enter the length” ; l
INPUT “Enter the breadth” ; b
AREA = l * b
PRINT “The area of rectangle is” ; AREA
END
To find volume of cuboid
CLS
REM To find volume of cuboid
INPUT “Enter the length” ; l
INPUT “Enter the breadth”: b
INPUT “Enter the height” ; h
VOLUME = l * b * h
PRINT “The volume of cuboid is”; VOLUME
END
To find volume of cube
CLS
REM To find volume of cube
INPUT “Enter the length” ; l
VOL = l ^3
PRINT “The volume of cube is” ; VOL
END
To find area of circle
CLS
REM”To find area of circle
INPUT “Enter the radius” ; r
LET PI = 3.14
AREA = PI * r^2
PRINT “The area of circle is” ; AREA
END
To find area of circle if radius is 6 cm
CLS
REM To find area of circle if radius is 6 cm
LET r = 6
LET PI = 3.14
AREA = PI * r ^ 2
PRINT “The area of circle is” ; AREA
END
To input student’s name, marks of any three subjects. Find total and percentage
CLS
REM “To find result”
INPUT “Enter the name of student” ; n$
INPUT “Enter the marks of English”; eng
INPUT “Enter the marks of Nepali” ; nep
INPUT “Enter the marks of Computer”; com
TOTAL = eng + nep + com
PER = eng + nep + com / 300 * 100
PRINT “Student’s name” ; n$
PRINT “Total marks of student” ; TOTAL
PRINT ” Percentage of student”; PER
END