Home  |  IT Zone  |  Tips / Tricks  |  Did You Know  |  Inspirational  |  Health  |  World Infos  |  Insurance  |  Universities  |  Forex  |  Mathematics  |  Illusions  |  Children Day Quotes  |  Fun / Jokes  |  Decent Quotes  |  Birthday Msgs  |  Good Morning Msgs  |  Good Night Msg  |  Husband Wife Jokes  |  Teacher Students Jokes  |  Insult Jokes  |  Love Quotes  |  Sad Quotes  |  Funny Pics  |  Be Aware  |  Articles  |  Simple Joys of Life 

Program to count repetition of a character in given string (Qbasic)

REM Program to count repetition of a character in given string (Qbasic Code)

CLS
INPUT "Enter a word"; w$
w$ = LCASE$(w$)
INPUT "Enter which character is to be counted for repetition"; a$
a$ = LCASE$(a$)
FOR i = 1 TO LEN(w$)
    r$ = MID$(w$, i, 1)
    IF r$ = a$ THEN u = u + 1
NEXT i
PRINT "The number of character: "; a$; " in the string "; w$; " is "; u
END

Share :

Twitter
Back To Top

facebook main

Powered by Blogger.