Saturday, October 22, 2016

Qbasic Program: N, Ne, Nep, Nepa, Nepal



262. WAP to display
N
NE
NEP
NEPA
NEPAL

USING SUB PROCEDURE

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

263. WAP to display
L
AL
PAL
EPAL
NEPAL
USING SUB PROCEDURE

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

264. WAP to display
NEPAL
EPAL
PAL
AL
L
USING SUB PROCEDURE

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
265. WAP to display
NEPAL
NEPA
NEP
NE
N

USING SUB PROCEDURE

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


266. WAP to display
N
E
P
A
L
USING SUB PROCEDURE
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

267. WAP to display
L
A
P
E
N
USING SUB PROCEDURE
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




268. WAP to display
N
   E
      P
        A
            L
USING SUB PROCEDURE
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


269. WAP to display
L
   A
      P
        E
            N
USING SUB PROCEDURE
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

270. WAP to display
NEPAL
EPA
P
USING SUB PROCEDURE
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

271. WAP to display
P
EPA
NEPAL
USING SUB PROCEDURE
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




272. WAP to display
NEPAL
   EPA
     P
USING SUB PROCEDURE
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



273. WAP to display
   P
EPA
NEPAL
USING SUB PROCEDURE
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


274. WAP to display
*
**
***
****
*****
******
*******

USING SUB PROCEDURE
DECLARE SUB PATTERN (S$)
CLS
S$ = "*******"
CALL PATTERN(S$)
END
SUB PATTERN (S$)
FOR I = 1 TO LEN(S$)
PRINT LEFT$(S$, I)
NEXT I
END SUB
275. WAP to display
*******
******
*****
****
***
**
*
USING SUB PROCEDURE

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

SUB PATTERN (S$)
FOR I = LEN(S$) TO 1 STEP -1
PRINT LEFT$(S$, I)
NEXT I
END SUB
276. WAP to display
*
**
***
****
*
**
***
****
*
*
*
*
CLS
S$ = "****"
FOR I = 1 TO LEN(S$)
PRINT LEFT$(S$, I)
NEXT I

FOR J = 1 TO LEN(S$)
PRINT LEFT$(S$, I)
NEXT J

FOR K = 1 TO LEN(S$)
PRINT MID$(S$, K, 1)
NEXT K

END

USING SUB PROCEDURE
DECLARE SUB PATTERN1 (S$)
DECLARE SUB PATTERN (S$)
CLS
S$ = "****"
CALL PATTERN(S$)
CALL PATTERN(S$)
CALL PATTERN1(S$)
END



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

SUB PATTERN1 (S$)
FOR K = 1 TO LEN(S$)
PRINT MID$(S$, K, 1)
NEXT K

END SUB

22 comments:

  1. Sir Can you please write a program to display the length of a string without using LEN Function. Thanks

    ReplyDelete
    Replies
    1. DECLARE FUNCTION userlen (a$)
      REM length of sting without LEN function
      CLS
      INPUT “Type any string value: ”; b$
      PRINT “Length of the string: “; userlen(b$)
      END

      FUNCTION userlen (a$)
      c=1
      aa:
      b$ = MID$(a$, c, 1)
      IF b$ < > “”
      p=p+1
      c=c+1
      GOTO aa
      END IF
      userlen = p
      END FUNCTION

      Delete
  2. N
    E
    P
    A
    L This types solution I need to know?

    ReplyDelete
  3. N * P * l
    N E P A
    N * P
    N E
    N
    how to print this in qb

    ReplyDelete
  4. .Sir Write a program to display the even number from 1 to 100.

    ReplyDelete
    Replies
    1. CLS
      FOR A=1 TO 100
      IF A MOD 2=0 THEN
      PRINT A;
      ENDIF
      NEXT A
      END

      Delete
  5. SIR PLZ DO THIS QUESTION
    *********
    * *
    * NEPAL *
    * *
    *********

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

    ReplyDelete

  7. ♡ ♡

    Sir how can we do this?

    ReplyDelete
  8. *
    ***
    *****
    *******
    *****
    ***
    *

    sir how to get this pattern

    ReplyDelete
  9. Sir , how to program this pattern plz?
    N
    EPA
    NEPAL

    ReplyDelete
  10. How to print this
    *N*
    **NE**
    ***NEP***
    ****NEPA****
    *****NEPAL*****

    ReplyDelete