Write a program to print following string pattern.
NEPAL
NEPA
NEP
NE
N
1 Answer
CLS
A$ = "NEPAL"
FOR I = LEN(A$) TO 1 STEP -1
B$ = LEFT$ (A$,1)
PRINT B$
NEXT I
END
FOLLOWING ARE THE IMPORTANT POINTS WE NEED TO REMEMBER IN PATTERNS:
- To start with string patterns, first we see which side has the similar patterns or characters. Like for pattern a, the letter 'N' is same on the left hand side whereas for pattern b) the letter 'L' is same on the right hand side. So we use LEFT$ for the pattern a and RIGHT$ for pattern b.
- Second, the patterns have to be printed using loop. The value of loop is determined by the number of character they have at the top. Like, for pattern a, the number of characters are 5 which is length of the string and in pattern c, it starts with 'N' which is 1.
- So for pattern a, we start the loop with LEN and the final value will be 1 and for pattern c we start the loop with 1 and the final value will be LEN.
- When we start loop with LEN, the step must be negative.
-
Who is a system analyst? What are the characteristics of system analysts? 1
-
What are the different stages of the system development life cycle (SDLC) 1
-
What do you understand about AI? What are the negative and positive aspects of AI in society? 1
-
How does an AI application work? Can a computer really think with the aid of AI? 1