Thursday, October 17, 2019

133. Qbasic program to print only the vowels from a given word.

133.      Write a program to declare SUB procedure to print only the vowels from a given word.

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

SUB DISPV(S$)
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 C$=C$+ B$
END IF
NEXT I
PRINT “VOWELS ONY ARE”; C$
END SUB

1 comment: