To print input string in alternate capital letters. (Qbasic Code)

To print input string in alternate capital letters. (if user inputs 'COMPUTER' or 'computer' then the output should be 'CoMpUtEr') (Qbasic Code)
  • CLS
    INPUT "Enter string:"; a$
    FOR i = 1 TO LEN(a$)
        b$ = MID$(a$, i, 1)
        IF i MOD 2 = 0 THEN
            b$ = LCASE$(b$)
        ELSE
            b$ = UCASE$(b$)
        END IF
        alt$ = alt$ + b$
    NEXT i
    PRINT "The required alternate is: "; alt$
    END
     

Share :

Twitter
Back To Top

facebook main

counter

Powered by Blogger.