String Pattern
N
NE
NEP
NEPA
NEPAL
CLS
A$=”NEPAL”
FOR I = 1 TO LEN (A$)
PRINT LEFT$(A$,i)
NEXT i
END
Display
NEPAL
NEPA
NEP
NE
N
CLS
A$ = “NEPAL”
FOR i = LEN(A$) TO 1 STEP -1
PRINT RIGHT$(A$, i)
NEXT i
END
Display:
PROGRAMMING
PROGRAMMIN
PROGRAMMI
PROGRAMM
PROGRAM
PROGRA
PROGR
PROG
PRO
PR
P
CLS
s$ = “PROGRAMMING”
t = 1
r = 1
FOR i = LEN(s$) TO 1 STEP -1
PRINT TAB(t); MID$(s$, r, i)
NEXT i
END
Display:
PROGRAMMING
ROGRAMMING
OGRAMMING
GRAMMING
RAMMING
AMMING
MMING
MING
ING
IN
G
CLS
s$ = “PROGRAMMING”
t = 1
r = 1
FOR i = LEN(s$) TO 1 STEP -1
PRINT TAB(t); MID$(s$, r, i)
r = r + 1
NEXT i
END
Display
L
AL
PAL
EPAL
NEPAL
CLS
A$ = “NEPAL”
FOR I = 1 TO LEN(A$)
PRINT RIGHT$(A$, I)
NEXT I
END
Display
NE
EP
PA
AL
CLS
a$ = “NEPAL”
x = LEN(a$)
FOR i = 1 TO x – 1
PRINT TAB(i); MID$(a$, i, 2)
NEXT i
END
Display
P
EPA
NEPAL
CLS
s$ = “NEPAL”
C = 1: b = 35
FOR i = 3 TO 1 STEP -1
PRINT TAB(b); MID$(s$, i, C)
C = C + 2
b = b – 1
NEXT i
END
Display
L
A
P
E
N
CLS
s$ = “NEPAL”
t = 3
FOR i = LEN(s$) TO 1 STEP -1
PRINT TAB(t); MID$(s$, i, 1)
t = t + 1
NEXT i
END
Display
L
A
P
E
N
CLS
s$ = “NEPAL”
t = 8
FOR i = LEN(s$) TO 1 STEP -1
PRINT TAB(t); MID$(s$, i, 1)
t = t – 1
NEXT i
END
Display
N
E
P
A
L
CLS
s$ = “NEPAL”
t = 8
FOR i = 1 TO LEN(s$)
PRINT TAB(t); MID$(s$, i, 1)
t = t – 1
NEXT i
END
Display
N
E
P
A
L
CLS
s$ = “NEPAL”
t = 8
FOR i = 1 TO LEN(s$)
PRINT TAB(t); MID$(s$, i, 1)
t = t + 1
NEXT i
END
Display
N
E
P
A
L
CLS
s$ = “NEPAL”
FOR i = 1 TO LEN(s$)
PRINT MID$(s$, i, 1)
NEXT i
END
Display
L
A
P
E
N
CLS
s$ = “NEPAL”
FOR i = LEN(s$) TO 1 STEP -1
PRINT MID$(s$, i, 1)
NEXT i
END
Display:
*
**
***
****
*****
*
**
***
****
*****
*
*
*
*
*
CLS
A$ = “*********”
A = 1
B = 1
FOR I = 1 TO 5
COLOR 4
PRINT MID$(A$, A, B)
B = B + 1
NEXT I
A = 1
B = 1
FOR J = 1 TO 5
COLOR 6
PRINT MID$(A$, A, B)
B = B + 1
NEXT J
FOR K = 1 TO 5
COLOR 5
PRINT MID$(A$, K, 1)
NEXT K
END
Display
*
**
***
****
*****
CLS
A$=”****”
FOR I = 1 TO LEN (A$)
PRINT LEFT$(A$,i)
NEXT i
END
OR
CLS
A$ = “*********”
A = 1
B = 1
FOR I = 1 TO 5
PRINT MID$(A$, A, B)
B = B + 1
NEXT I
END
Display
*****
****
***
**
*
CLS
A$ = “*****”
FOR I = LEN(A$) TO 1 STEP -1
PRINT LEFT$(A$, I)
NEXT I
END
OR
CLS
A$ = “*********”
A = 1
B = 5
FOR I = 5 to 1 step -1
PRINT MID$(A$, A, B)
B = B -1
NEXT I
END
R
GRA
OGRAM
ROGRAM
PROGRAM
CLS
s$ = “PROGRAM”
c = 1: b = 40
FOR i = 5 TO 1 STEP -1
PRINT TAB(b); MID$(s$, i, c)
c = c + 2
b = b – 1
NEXT i
END
*********
*******
*****
***
*
CLS
A$ = “***********”
C = 9: B = 30
FOR I = 1 TO 5
PRINT TAB(B); MID$(A$, I, C)
C = C – 2
B = B + 1
NEXT I
END
Display:
A
RAM
GRAMM
OGRAMMI
ROGRAMMIN
PROGRAMMING
CLS
s$ = “PROGRAMMING”
t = 6
FOR i = 1 TO LEN(s$) STEP 2
PRINT TAB(t); MID$(s$, t, i)
t = t – 1
NEXT i
END
Display:
PROGRAMMING
ROGRAMMIN
OGRAMMI
GRAMM
RAM
A
CLS
s$ = “PROGRAMMING”
t = 1
FOR i = LEN(s$) TO 1 STEP -2
PRINT TAB(t); MID$(s$, t, i)
t = t + 1
NEXT i
END
N
E E E
P P P
A A A
L L L
CLS
s$ =”NEPAL”
t = 12: Q = 10: R = 14: s = 12
PRINT TAB(t); “N”
FOR K = 2 TO 5
z$ = MID$(s$, K, 1)
PRINT TAB(Q); z$; TAB(R); z$; TAB(s); z$
Q = Q – 2: R = R + 2: s = s + 0
NEXT
END
COMPUTER
OMPUTER
MPUTE
PUT
U
CLS
s$ = “COMPUTER”
c = 9: s = 30
FOR i = 1 TO 5
PRINT MID$(s$, i, c)
c = c – 2: s = s + 1
NEXT i
END