Count total no. of consonants in a string
DECLARE FUNCTION COUNT(N$)
CLS
INPUT"ENTER STRING";N$
PRINT"TOTAL NO. OF CONSONANTS =";COUNT(N$)
END
FUNCTION COUNT(N$)
FOR I= 1 TO LEN (N$)
B$= MID $(N$,I,1)
C$=UCASE$(B$)
IF C$< >"A" ORC$< >"E" OR C$< >"I" OR C$< >"O" OR C$< >"U" THEN C=C+1
NEXT I
COUNT=C
END FUNCTION
CLS
INPUT"ENTER STRING";N$
PRINT"TOTAL NO. OF CONSONANTS =";COUNT(N$)
END
FUNCTION COUNT(N$)
FOR I= 1 TO LEN (N$)
B$= MID $(N$,I,1)
C$=UCASE$(B$)
IF C$< >"A" ORC$< >"E" OR C$< >"I" OR C$< >"O" OR C$< >"U" THEN C=C+1
NEXT I
COUNT=C
END FUNCTION
Comments
Post a Comment