Here, I have listed some of the qbasic programs. We also have mobile app where you can view all the qbasic programs. For better experience I highy recommend you to use our mobile app.
Please download our app by clicking the image below:
If the above link is not working. You can use this link –> https://play.google.com/store/apps/details?id=com.allbachelor.qbasicapp
101 Write a program to input any number and check whether the given no. is positive negative or zero.
CLS
INPUT “ENTER ANY NUMBER”; N
IF N > 0 THEN
PRINT N; IS POSITIVE NUMBER”
ELSEIF N < 0 THEN
PRINT N; IS NEGATIVE NUMBER”
ELSE
PRINT N; IS ZERO”
END IF
END
102 Write a program in qbasic to generate the following series 55555 4444 333 22 1
CLS
FOR I = 5 TO 1 STEP -1
FOR J = 1 TO I
PRINT I;
NEXT J
PRINT
NEXT I
END
103 Write a program in qbasic to print all odd numbers from 1 to 100 in descending order
CLS
FOR I = 99 TO 1 STEP - 2
PRINT I,
NEXT I
END
104 Write a program to enter any two numbers and display the smaller one.
CLS
INPUT “ENTER ANY TWO NUMBERS”; A, B
IF A < B THEN
PRINT A; “IS SMALLER”
ELSE
PRINT B; “IS SMALLER”
END IF
END
105 Write a program in qbasic to print numbers 1 3 5……..30
CLS
FOR I = 1 TO 30 STEP 2
PRINT I,
NEXT I
END
106 Write a program to input the age of a person and find out whether the person is eligible to vote or not.
CLS
INPUT “ENTER YOUR AGE”; A
IF A >= 18 THEN
PRINT “YOU ARE ELIGIBLE TO VOTE”
ELSE
PRINT “ YOU ARE NOT ELIGIBLE TO VOTE”
END IF
END
107 Write a program in qbasic to print the sum of even numbers between 2 to 50
CLS
FOR I = 2 TO 50 STEP 2
S = S + I
NEXT I
PRINT “SUM OF EVEN NUMBERS BETWEEN 2 TO 50” ; S
END
108 Write a program in qbasic using to print product of all numbers from 4 to 8
CLS
P = 1
FOR I = 4 TO 8
P = P * I
NEXT I
PRINT “PRODUCT OF ALL NUMBERS FROM 4 TO 8”; P
END
109 Write a program in qbasic to print the series 2 8 18 32…..upto 10th term
CLS
FOR i = 1 TO 10
PRINT i ^ 2 * 2;
NEXT i
END
110 Write a program in qbasic to generate the following series 5 54 543 5432 54321
CLS
FOR I = 5 TO 1 STEP -1
FOR J = 5 TO I STEP -1
PRINT J;
NEXT J
PRINT
NEXT I
END
111 Write a program in qbasic to ask number and find sum square of digits
CLS
INPUT "ENTER ANY NUMBER"; N
S = 0
WHILE N < > 0
R = N MOD 10
S = S + R ^ 2
N = N \ 10
WEND
PRINT "SUM OF SQUARE OF DIGITS"; S
END
112 Write a program in qbasic to ask any string and count total no. of words
CLS
INPUT "ENTER ANY STRING"; S$
WC = 1
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
IF B$ = " " THEN
WC = WC + 1
END IF
NEXT I
PRINT "TOTAL NO. OF WORDS= "; WC
END
113 Write a program in qbasic to ask any string and count total no. of vowels
CLS
INPUT "ENTER ANY STRING"; S$
VC = 0
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ = "A" OR C$ = "E" OR C$ = "I" OR C$ = "O" OR C$ = "U" THEN
VC = VC + 1
END IF
NEXT I
PRINT "TOTAL NO. OF VOWELS= "; VC
END
114 Write a program in qbasic TO PRINT H.C.F AND L.C.M OF ANY TWO Given NUMBERS by user
CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
C = A
D = B
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
L = C * D / B
PRINT "H.C.F="; B
PRINT "L.C.M="; L
END
115 Write a program in qbasic to generate the series 3 10 5 16………………11th term
CLS
A = 3
FOR I = 1 TO 11
PRINT A;
IF A MOD 2 = 0 THEN
A = A \ 2
ELSE
A = A * 3 + 1
END IF
NEXT I
END
116 Write a program in qbasic to print the following series 9 7 5 …1
CLS
FOR I = 9 TO 1 STEP-2
PRINT I
NEXT I
END
117 Write a program in qbasic to convert decimal number to hexadecimal number
CLS
INPUT "ENTER DECIMAL NUMBER"; D
WHILE D < > 0
R = D MOD 16
IF R < 10 THEN
S$ = STR$(R) + S$
ELSE
S$ = CHR$(R + 55) + S$
END IF
D = D \ 16
WEND
PRINT "HEXADECIMAL EQUIVALENT VALUE="; S$
END
118 Write a program in qbasic to ask any number and print the prime factors
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "PRIME FACTORS OF"; N; "=";
FOR I = 1 TO N
C = 0
FOR J = 1 TO I
IF I MOD J = 0 THEN C = C + 1
NEXT J
IF N MOD I = 0 AND C = 2 THEN PRINT I;
NEXT I
END
119 Write a program in qbasic TO PRINT H.C.F OF A GIVEN ANY TWO NUMBERS
CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
PRINT "H.C.F="; B
END
120 Write a program in qbasic to print all odd numbers from 1 to 100
CLS
FOR I = 1 TO 100 STEP 2
PRINT I,
NEXT I
END
Please download our app by clicking the image below:
If the above link is not working. You can use this link –> https://play.google.com/store/apps/details?id=com.allbachelor.qbasicapp