Thursday, October 17, 2019

131. Qbasic program to find the numbers of vowels in an input string


131.      Write a program to find the numbers of vowels in an input string using ‘SUB…..END SUB’. 

DECLARE SUB COUNT (S$)
CLS
INPUT "ENTER ANY STRING"; S$
CALL COUNT(S$)
END

SUB COUNT (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
NEXT I
PRINT "TOTAL NO. OF VOWELS= "; VC
END SUB

No comments:

Post a Comment