Qbasic program to generate the pattern 5,55,555,5555,55555
5 55 555 5555 55555
CLS
A = 5
FOR I = 1 TO 5
PRINT A,
A = A * 10 + 5
NEXT I
END
USING SUB
DECLARE SUB PATTERN()
CLS
CALL PATTERN
END
SUB PATTERN
A = 5
FOR I = 1 TO 5
PRINT A,
A = A * 10 + 5
NEXT I
END SUB
0 Comments