QBASIC Program To Input A Word And Print Consonant Letters
QBASIC Program To Input A Word And Print Consonant Letters
CLS
INPUT " Enter a word"; W$
FOR I = 1 TO LEN(W$)
A$ = MID$(W$, I, 1)
B$ = UCASE$(B$)
IF B$ <> "A" AND B$ <> "E" AND B$ <> "I" AND B$ <> "O" AND B$ <> "U" THEN
C$ = C$ + A$
END IF
A$ = MID$(W$, I, 1)
B$ = UCASE$(B$)
IF B$ <> "A" AND B$ <> "E" AND B$ <> "I" AND B$ <> "O" AND B$ <> "U" THEN
C$ = C$ + A$
END IF
NEXT I
PRINT" The consonant letters are "; C$
END
QBASIC Program To Input A Word And Print Consonant Letters Using SUB Procedure
DECLARE SUB Consonant(W$)
CLS
INPUT "Enter a word"; W$
CALL Consonant(W$)
END
SUB Consonant(W$)
FOR I = 1 TO LEN(W$)
A$ = MID$(W$, I, 1)
B$ = UCASE$(B$)
IF B$ <> "A" AND B$ <> "E" AND B$ <> "I" AND B$ <> "O" AND B$ <> "U" THEN
C$ = C$ + A$
END IF
A$ = MID$(W$, I, 1)
B$ = UCASE$(B$)
IF B$ <> "A" AND B$ <> "E" AND B$ <> "I" AND B$ <> "O" AND B$ <> "U" THEN
C$ = C$ + A$
END IF
NEXT I
PRINT" The consonant letters are "; C$
END SUB
QBASIC Program To Input A Word And Print Consonant Letters Using FUNCTION Procedure
DECLARE FUNCTION Consonant$(W$)CLS
INPUT" Enter a word"; W$
PRINT "The consonant letters are "; Consonant$(W$)
END
FUNCTION Consonant$(W$)
FOR I = 1 TO LEN(W$)
A$ = MID$(W$, I, 1)
B$ = UCASE$(B$)
IF B$ <> "A" AND B$ <> "E" AND B$ <> "I" AND B$ <> "O" AND B$ <> "U" THEN
C$ = C$ + A$
END IF
NEXT I
Consonant$ = C$
END FUNCTION
END
FUNCTION Consonant$(W$)
FOR I = 1 TO LEN(W$)
A$ = MID$(W$, I, 1)
B$ = UCASE$(B$)
IF B$ <> "A" AND B$ <> "E" AND B$ <> "I" AND B$ <> "O" AND B$ <> "U" THEN
C$ = C$ + A$
END IF
NEXT I
Consonant$ = C$
END FUNCTION
Comments
Post a Comment