QBASIC PROGRAM TO FIND TOTAL NO. OF VOWELS, CONSONANTS, WORDS AND SENTENCES FROM A STRING

QBASIC PROGRAM TO FIND TOTAL NO. OF VOWELS, CONSONANTS, WORDS AND SENTENCES FROM A STRING



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
 PRINT TOTAL NO. OF WORDS=; WC
 PRINT TOTAL NO. OF SENTENCES=; SC
 END

Post a Comment

0 Comments