To generate the given pattern (Using FUCTION Procedure) (Qbasic Code)

To generate the given pattern (Using FUCTION Procedure) (Qbasic Code)
C
CO
COM
COMP
COMPU
COMPUT
COMPUTE
COMPUTER
  • Without parameters
  • DECLARE FUNCTION pattern()
    CLS
    p = pattern
    END
    FUNCTION pattern
    a$ = "COMPUTER"
    FOR i = 1 TO LEN(a$)
        PRINT LEFT$(a$, i)
    NEXT i
    END FUNCTION
  • With parameters
  • DECLARE FUNCTION pattern$(a$)
    CLS
    p$ = pattern$(a$)
    END
    FUNCTION pattern$ (a$)
    a$ = "COMPUTER"
    FOR i = 1 TO LEN(a$)
        PRINT LEFT$(a$, i)
    NEXT i
    END FUNCTION

Share :

Facebook Twitter Google+
Back To Top

facebook main

counter

Powered by Blogger.