Wednesday, October 13, 2021

Qbasic Program to print the pattern 1, 12, 123, 1234, 12345 (With SUB/FUNCTION Procedure)

OUTPUT

CLS
FOR i = 1 TO 5
     FOR j = 1 TO i
          PRINT j;
     NEXT j
     PRINT
NEXT i
END


Print Pattern Using SUB Procedure

DECLARE SUB pattern()
CLS
CALL pattern
END

SUB pattern
     FOR i = 1 TO 5
          FOR j = 1 TO i
               PRINT j;
          NEXT j
          PRINT
     NEXT i
END SUB


Print Pattern Using FUNCTION Procedure

DECLARE FUNCTION pattern()
CLS
p = pattern
END

FUNCTION pattern
     FOR i = 1 TO 5
          FOR j = 1 TO i
               PRINT j;
          NEXT j
          PRINT
     NEXT i
END FUNCTION

No comments:

Post a Comment

If you have any doubts, Please let me know.

[Download PDF] Computer Science Book Gread-10 in Nepali Language

 If you are searching for class 10 Computer Science in Nepali pdf for free download then you are at the right page. This book is soley publi...