Some Solved Examples of QBASIC programming.
Q.no-1) Write a QBASIC program to find the Area and Perimeter of a Rectangle.
CLS
REM QBASIC program to find the Area and Perimeter of a Rectangle
INPUT “Enter the Length of a Rectangle”; L
INPUT “ Enter the Breadth of a Rectangle”; B
A = L * B
P = 2 * (L + B)
PRINT “ The Area of a Rectangle is “; A
PRINT “ The Perimeter of a Rectangle is “; P
END
Q.no-2) Write a QBASIC program to find the Area and Perimeter of a Square.
CLS
REM QBASIC program to find the Area and Perimeter of a Square
INPUT “Enter the Length of a Square”; L
A = L * L
P = 4 * L
PRINT “ The Area of a Square is “; A
PRINT “ The Perimeter of a Square is “; P
END
Q.no- 3) Write a QBASIC program to find the Area of a Circle.
CLS
REM
QBASIC program to find the Area of a Circle
INPUT “Enter the Radius of a Circle”; R
LET PI = 3.142
A = PI * R * R
PRINT “ The Area of a Circle is “; A
END
Q.no -4) Write a QBASIC program to find the Circumference of a Circle.
CLS
REM QBASIC program to find the Circumference of a Circle
INPUT “Enter the Radius of a Circle”; R
LET PI = 3.142
C = 2 * PI * R
PRINT ” The Circumference of a Circle is “; C
END
Q.no-5) Write a QBASIC program to find the Simple Interest.
CLS
REM QBASIC program to find the Simple Interest
INPUT “Enter the Principle”; P
INPUT ” Enter the Time”; T
INPUT ” Enter the Rate”; R
I = (P * T * R) / 100
PRINT ” The Simple Interest is “; I
END
Q.no-6) Write a QBASIC program to take input from the user and find the SUM of two numbers.
CLS
REM QBASIC program to find the SUM of two numbers
INPUT “Enter the First Number”; A
INPUT ” Enter the Second Number”; B
SUM = A + B
PRINT ” The SUM of two numbers is “; SUM
END
Q.no-7) Write a QBASIC program to take input from the user and find the Product of two numbers.
CLS
REM QBASIC program to find the Product of any two numbers.
INPUT “Enter the First Number”; A
INPUT “Enter the Second Number”; B
P = A * B
PRINT “The Product of two numbers is”; P
END
Q.no-8) Write a QBASIC program to take input of marks obtained in 3 subjects and find the Average marks.
CLS
REM QBASIC program to find the Average of three subjects
INPUT “Enter the marks obtained in Science”; S
INPUT ” Enter the marks obtained in Mathematics”; M
INPUT ” Enter the marks obtained in Computer”; C
AV = (S + M + C) / 3
PRINT ” The Average of three subjects is “; AV
END
Q.no-9) Write a QBASIC program to convert Indian Currency into Nepalese Currency.
CLS
REM QBASIC program to convert Indian Currency into Nepalese Currency
INPUT “Enter the amount of Indian Currency”; IC
LET NC = IC * 1.6
PRINT ” The Equivalent Nepalese Currency is “; NC
END
Q.no-10) Write a QBASIC program to convert Meter into Kilometer.
CLS
REM QBASIC program to convert Meter into Kilometer
INPUT “Enter the measurement in Meter”; M
LET KM = M / 1000
PRINT “The Equivalent Kilometer is”; KM
END
Q.no-11) Write a QBASIC program to display Multiplication Table of 9.
CLS
REM QBASIC program to display Multiplication Table of 9
LET N = 9
FOR I = 1 TO 10
PRINT N; ” x “; I; ” = “; N * I; ” “
NEXT I
END
Q.no-12) Write a QBASIC program to display Multiplication Table of any input number.
CLS
REM QBASIC program to display Multiplication Table of any input number
INPUT “Enter any number”; N
FOR I = 1 TO 10
a = N * I
PRINT N; “x”; I; “=”; a
NEXT I
END
About the author:
Mr. Prashant Paudel is a tech-savvy and a proficient IT graduate from Tribhuvan University. He has a strong passion on writing blogs related to IT and Computer Science. He has been involving in writing technical blogs since 2016, and has been profoundly contributing to this field. He is currently working as a content creator for the Website named Lattice Nepal.