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 enter a string and count total number of vowels. (Qbasic Code)

To enter a string and count total number of vowels. (Qbasic Code)
  • CLS
    INPUT "Enter the string"; a$
    b$ = LCASE$(a$)
    FOR i = 1 TO LEN(b$)
        c$ = MID$(b$, i, 1)
        IF c$ = "a" OR c$ = "e" OR c$ = "i" OR c$ = "o" OR c$ = "u" THEN
            c = c + 1
        END IF
    NEXT i
    PRINT "The number of vowels in the string is "; c
    END

Next Method (Using SELECT CASE)
  • CLS
    INPUT "Enter the string"; a$
    b$ = LCASE$(a$)
    FOR i = 1 TO LEN(b$)
        c$ = MID$(b$, i, 1)
        SELECT CASE c$
            CASE "a", "e", "i", "o", "u"
                c = c + 1
        END SELECT
    NEXT i
    PRINT "The number of vowels in the string is "; c
    END 
See Also
Using SUB Procedure
Using  FUNCTION Procedure

Share :

Twitter
Back To Top

facebook main

Powered by Blogger.