QBASIC Program To Input A Word And Print Vowel Letters

 QBASIC Program To Input A Word And Print Vowel Letters 

QBASIC Program To Input A Word And Print Vowel Letters




QBASIC Program To Input A Word And Print Vowel Letters 


CLS
INPUT " Enter a word"; W$
FOR I = 1 TO LEN(W$)
A$ = MID$(W$, I, 1)
B$ = UCASE$(B$)
IF B$ = "A" OR B$ = "E" OR B$ = "I" OR B$ = "O" OR B$ = "U" THEN
C$ = C$ + A$
END IF
NEXT I
PRINT" The vowel letters are "; C$ 
END
 

QBASIC Program To Input A Word And Print Vowel Letters Using SUB Procedure


DECLARE SUB Vowel(W$)
CLS
INPUT "Enter a word"; W$
CALL Vowel(W$)
END
SUB Vowel(W$)
FOR I = 1 TO LEN(W$)
A$ = MID$(W$, I, 1)
B$ = UCASE$(B$)
IF B$ = "A" OR B$ = "E" OR B$ = "I" OR B$ = "O" OR B$ = "U" THEN
C$ = C$ + A$
END IF
NEXT I
PRINT" The vowel letters are "; C$ 
END SUB


QBASIC Program To Input A Word And Print Vowel Letters Using FUNCTION Procedure

DECLARE FUNCTION Vowel$(W$)
CLS
     INPUT" Enter a word"; W$
PRINT "The vowel letters are "; Vowel$(W$)
END
FUNCTION Vowel$(W$)
FOR I = 1 TO LEN(W$)
A$ = MID$(W$, I, 1)
B$ = UCASE$(B$)
IF B$ = "A" OR B$ = "E" OR B$ = "I" OR B$ = "O" OR B$ = "U" THEN
C$ = C$ + A$
END IF
NEXT I
Vowel$ = C$
END FUNCTION

Comments