Thursday, October 17, 2019

137. Qbasic program to input any string and display only consonant by removing vowels


137.      Write a sub program to input any string and display only consonant by removing vowels.

DECLARE FUNCTION DISP$ (S$)
CLS
INPUT "ENTER ANY STRING"; S$
PRINT DISP(S$)
END

FUNCTION DISP$ (S$)
FOR I = 1 TO LEN(S$)
B$ = MID$(S$, I, 1)
C$ = UCASE$(B$)
IF C$ <> "A" AND C$ <> "E" AND C$ <> "I" AND C$ <> "O" AND C$ <> "U" AND C$ <> " " THEN W$=W$+B$
END IF
NEXT I
DISP$ =  W$
END FUNCTION

No comments:

Post a Comment