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 

To count the number of words in given string. (Qbasic Code)

To count the number of words in given string. (Qbasic Code)
  • CLS
    1:
    INPUT "Enter the string"; a$
    IF a$ = "" THEN
        PRINT "No input given. ";
        PRINT
        GOTO 1:
    END IF
    c = 1
    FOR i = 1 TO LEN(a$)
        IF MID$(a$, i, 1) = " " THEN
            c = c + 1
        END IF
    NEXT i
    PRINT "The total number of words is"; c
    END

Share :

Twitter
Back To Top

facebook main

Powered by Blogger.