QBASIC Program To Input A Word And Count The Number Of Vowel Letters
QBASIC Program To Input A Word And Count The Number Of 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 + 1
END IF
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 + 1
END IF
PRINT" Total number of vowel letter"; C
END
QBASIC Program To Input A Word And Count The Number Of Vowel Letters Using SUB Procedure
DECLARE SUB COUNT(W$)
CLS
INPUT "Enter a word"; W$
CALL COUNT(W$)
END
SUB COUNT(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 + 1
END IF
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 + 1
END IF
PRINT" Total number of vowel letter"; C
END SUB
QBASIC Program To Input A Word And Count The Number Of Vowel Letters Using FUNCTION Procedure
DECLARE FUNCTION COUNT(W$)CLS
INPUT" Enter a word"; W$
PRINT "Total number of vowel letters "; COUNT(S$)
END
FUNCTION COUNT (S$)
FOR I = 1 TO LEN(S$)
A$ = MID$(S$, I, 1)
B$ = UCASE$(B$)
IF B$ = "A" OR B$ = "E" OR B$ = "I" OR B$ = "O" OR B$ = "U" THEN
C = C + 1
END IF
NEXT I
COUNT = C
END FUNCTION
END
FUNCTION COUNT (S$)
FOR I = 1 TO LEN(S$)
A$ = MID$(S$, I, 1)
B$ = UCASE$(B$)
IF B$ = "A" OR B$ = "E" OR B$ = "I" OR B$ = "O" OR B$ = "U" THEN
C = C + 1
END IF
NEXT I
COUNT = C
END FUNCTION
Ideakard India Pvt Ltd provides you high quality range of product such as wireless keyboard and mouse, power surge protectors, bluetooth earphone, headset with mic, wired keyboard and mouse, bluetooth speakers etc
ReplyDeleteIdeakard India Pvt Ltd