QBASIC PROGRAM TO COUNT 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
USING SUB
DECLARE SUB VOWELS()
CLS
INPUT ENTER ANY STRING; S$
CALL VOWELS
END
SUB VOWELS
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 SUB
0 Comments