Basic Program To Tell How Many Times a Char Repeats in a String

REM THIS PROGRAMME TELLS HOW MANY TIMES A CHAR REPEATS IN A STRING
CLS
COUNT = 0
INPUT “ENTER ANY STRING”; N$
INPUT “ENTER ANY CHARACTER”; A$
L = LEN(N$)
FOR T = 1 TO L
LET S$ = MID$(N$, T, 1)
IF S$ = A$ THEN COUNT = COUNT + 1
NEXT T
PRINT “TOTAL NO OF OCCURENCE OF “; A$; ” IS”; COUNT; “times”
END

Please follow and like us:

Leave a comment