Friday, November 18, 2016

Patterns Of Nepal in QBASIC




1. WRITE A PROGRAM TO PRINT THE FOLLOWING PATTERN
N
NE
NEP
NEPA
NEPAL



DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
FOR I = 1 TO LEN(S$)
PRINT LEFT$(S$, I)
NEXT I
END SUB

2.WRITE A PROGRAM TO PRINT THE FOLLOWING PATTERN

L
AL
PAL
EPAL
NEPAL


DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
FOR I = 1 TO LEN(S$)
PRINT RIGHT$(S$, I)
NEXT I
END SUB


3.WRITE A PROGRAM TO PRINT THE FOLLOWING PATTERN
NEPAL
EPAL
PAL
AL
L


DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
FOR I = LEN(S$) TO 1 STEP - 1
PRINT RIGHT$(S$, I)
NEXT I
END SUB


4.           WRITE A PROGRAM  TO PRINT THE FOLLOWING PATTERN
NEPAL
NEPA
NEP
NE
N



DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
FOR I = LEN(S$) TO 1 STEP - 1
PRINT LEFT$(S$, I)
NEXT I
END SUB

5.WRITE A PROGRAM  TO PRINT THE FOLLOWING PATTERN
N
E
P
A
L

DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
FOR I = 1 TO LEN(S$)
PRINT MID$(S$, I, 1)
NEXT I
END SUB

6.           WRITE A PROGRAM  TO PRINT THE FOLLOWING PATTERN
L
A
P
E
N

DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
FOR I = LEN(S$) TO 1 STEP -1
PRINT MID$(S$, I, 1)
NEXT I
END SUB

7.           WRITE A PROGRAM  TO PRINT THE FOLLOWING PATTERN
N
   E
      P
        A
            L

DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
FOR I = 1 TO LEN(S$)
PRINT TAB(I); MID$(S$, I, 1)
NEXT I
END SUB


8. WRITE A PROGRAM  TO PRINT THE FOLLOWING PATTERN
L
   A
      P
        E
            N

DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
B = 1
FOR I = LEN(S$) TO 1 STEP -1
PRINT TAB(B); MID$(S$, I, 1)
B = B + 1
NEXT I
END SUB


9. WRITE A PROGRAM  TO PRINT THE FOLLOWING PATTERN
NEPAL
EPA
P

DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
A = 1
FOR I = LEN(S$) TO 1 STEP -2
PRINT MID$(S$, A, I)
A = A + 1
NEXT I
END SUB

10.       WRITE A PROGRAM  TO PRINT THE FOLLOWING PATTERN
P
EPA
NEPAL

DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
A = 3
FOR I = 1 TO LEN(S$) STEP 2
PRINT MID$(S$, A, I)
A = A - 1
NEXT I
END SUB

11.        WRITE A PROGRAM  TO PRINT THE FOLLOWING PATTERN
NEPAL
   EPA
     P

DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
A = 1
FOR I = LEN(S$) TO 1 STEP -2
PRINT TAB(A); MID$(S$, A, I)
A = A + 1
NEXT I
END SUB



12.       WRITE A PROGRAM  TO PRINT THE FOLLOWING PATTERN
   P
EPA
NEPAL

DECLARE SUB PATTERN (S$)
CLS
S$ = "NEPAL"
CALL PATTERN(S$)
END

SUB PATTERN (S$)
A = 3
FOR I = 1 TO LEN(S$) STEP 2
PRINT TAB(A); MID$(S$, A, I)
A = A - 1
NEXT I

END SUB

13 comments:

  1. Post your questions here!!!!!!!!!!

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. 1 1
    2 2
    3
    4 4
    5 5

    How to do this??
    in qbasic

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Write a program to print the following pattern using SUB......END SUB.
    1
    2 4
    3 6 9
    4 8 12 16
    5 10 15 20 25

    ReplyDelete
  6. How to generate this pattern??

    N
    E
    P
    A
    L

    ReplyDelete
  7. How to generate this?
    NEPAL
    EPAL
    PAL
    AL
    L


    ReplyDelete
  8. L
    AL
    PAL
    EPAL
    NEPAL
    How to generate this ? Please help

    ReplyDelete
  9. WAP To Print:- (Please Solve This)
    N
    E
    P
    A
    L
    A
    P
    E
    N

    ReplyDelete

Featured Post

Conversion of decimal numbers into other number system and vice versa

ht Conversion of decimal numbers into other number system and vice versa 1. Write a QBASIC program to convert any decimal number in...