Qbasic programs solutions(part 12) for class 8, class 9 and class 10

Codynn
6 Min Read
qbasic programs for class 8,9 and 10 part 12

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 highly recommend you to use our mobile app.

Please download our app by clicking the image below:

Download Qbasic application on your phone
Download Qbasic application on your phone

f the above link is not working. You can use this link –> https://play.google.com/store/apps/details?id=com.allbachelor.qbasicapp

221  Write a program in qbasic to generate the following series 54321   5432   543   54   5    

CLS 
FOR I = 5 TO 1 STEP -1 
FOR J = I TO 1 STEP -1 
PRINT J; 
NEXT J 
PRINT 
NEXT I 
END 

222  Write a program to enter any 20 numbers and display the smallest one using    

CLS 
DIM N(20) 
FOR I = 1 TO 20 
INPUT "ENTER THE NUMBERS"; N(I) 
NEXT I 
S = N(1) 
FOR I = 2 TO 20 
IF N(I)  < S THEN S = N(I) 
NEXT I 
PRINT “THE SMALLEST NUMBER IS”; S 
END 

223  Write a program to solve a quadratic equation ax2+bx+c=0 on the basis of the coefficient values a    b    and c.    

REM SOLVE A QUADRATIC EQUATION 
CLS 
INPUT "ENTER VALUE FOR A"; A 
INPUT "ENTER VALUE FOR B"; B 
INPUT "ENTER VALUE FOR C"; C 
D = (B * B - 4 * A * C) ^ (1 / 2) 
X = (-B + D) / 2 * A 
Y = (-B - D) / 2 * A 
PRINT "SOLUTION OF QUADRATIC EQUATION ARE"; X; Y 
END 

224  Write a program in qbasic to print -30   -20   -10   0   10   ……………20th terms    

CLS 
A = -30 
FOR I = 1 TO 20 
PRINT A, 
A = A + 10 
NEXT I 
END 

225  Write a program in qbasic to ask any string and print only consonant by removing vowels    

CLS 
INPUT "ENTER ANY STRING"; S$ 
FOR I = 1 TO LEN(S$) 
B$ = MID$(S$, I, 1) 
C$ = UCASE$(B$) 
IF C$ <> "A" AND C$  <> "E" AND C$  <> "I" AND C$  <> "O" AND C$  <> "U" AND C$  <> " " AND C$  <> "." THEN 
W$=W$+B$ 
END IF 
NEXT I 
PRINT W$ 
END 

226  Write a program in qbasic to ask number and count total number of digits    

CLS 
INPUT "ENTER ANY NUMBER"; N 
C = 0 
WHILE N  <> 0 
C = C + 1 
N = N \ 10 
WEND 
PRINT "TOTAL NUMBER OF DIGITS"; C 
END 


227  Write a program in qbasic to find the sum of all even numbers from 2 to 100    

CLS 
FOR I = 2 TO 100 STEP 2 
PRINT I, 
NEXT I 
END 

228  Write a program in qbasic to ask any string and count total no of vowels and consonants    

CLS 
INPUT "ENTER ANY STRING"; S$ 
VC = 0 
CC = 0 
WC = 1 
SC = 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 
ELSEIF B$ = " " THEN 
WC = WC + 1 
ELSEIF B$ = "." THEN 
SC = SC + 1 
ELSE 
CC = CC + 1 
END IF 
NEXT I 
PRINT "TOTAL NO. OF VOWELS= "; VC 
PRINT "TOTAL NO. OF CONSONANTS="; CC 
END 

229  Write a program in QBasic to enter any 10 numbers and find the sum of odd numbers    

CLS 
FOR I = 1 TO 10 
INPUT "ENTER THE NUMBERS"; N(I) 
IF N(I) MOD 2 = 1 THEN S = S + N(I) 
NEXT I 
PRINT "SUM OF 10 ODD NUMBERS"; S 
END 

230  Write a program to convert  Nepalese currency into Indian currency.    

CLS 
INPUT “ENTER NEPALESE CURRENCY ” ; P 
C=P/1.6 
PRINT “INDIAN CURRENCY “; C 
END

231  Write a program to check whether the input number is divisible by 4 and  6  or not.    

CLS 
INPUT “ENTER  A NUMBER ” ; P 
IF P MOD 4 =0 AND P MOD 6=0 THEN 
PRINT “DIVISIBLE BY BOTH NUMBERS” 
ELSE 
PRINT “NOT DIVISIBLE BY BOTH NUMBERS” 
ENDIF 
END 

232  Write a program to input monthly income in to compute annual tax to be paid. The tax rate is 15% if annual income is above Rs. 500000    otherwise tax rate is 10%.    

CLS 
INPUT “Enter monthly income”; I 
A=I*12 
IF A>500000 THEN 
TAX=15/100*A 
PRINT "Total amount of tax to be paid is"; TAX 
ELSE 
TAX=10/100*A 
END IF 
END 

Please download our app by clicking the image below:

Download Qbasic application on your phone
Download Qbasic application on your phone

If the above link is not working. You can use this link –> https://play.google.com/store/apps/details?id=com.allbachelor.qbasicapp

Share This Article
1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *