To enter a string and count total number of vowels (using SUB Procedure). (Qbasic Code)
- DECLARE SUB vowel(w$)
CLS
INPUT "Enter any word"; w$
CALL vowel(w$)
END
SUB vowel (w$)
w$ = LCASE$(w$)
FOR i = 1 TO LEN(w$)
c$ = MID$(w$, i, 1)
IF c$ = "a" OR c$ = "e" OR c$ = "i" OR c$ = "o" OR c$ = "u" THEN
n = n + 1
END IF
NEXT i
PRINT "The number of vowels ="; n
END SUB