To generate the given pattern Using SUB Procedure (QBasic Code)

To generate the given pattern using SUB Procedure
C
CO
COM
COMP
COMPU
COMPUT
COMPUTE
COMPUTER

  • DECLARE SUB pattern (a$)
    CLS
    CALL pattern(a$)
    END

    SUB pattern (a$)
    LET a$ = "COMPUTER"
    FOR i = 1 TO LEN(a$)
        PRINT LEFT$(a$, i)
    NEXT i
    END SUB

Share :

Facebook Twitter Google+
Back To Top

facebook main

counter

Powered by Blogger.