Thursday, 9 February 2017

Array program in qbasic to insert a number

CLS
DIM N(11) AS INTEGER,A%,P%,I%
PRINT "ENTER TEN NUMBER"
FOR I = 1 TO 10
    INPUT N(I)
NEXT

INPUT "ENTER NUMBER WHICH YOU WANT TO INSERT"; A
INPUT "ENTER THE POSITION (WITHIN 10)"; P
FOR I = 10 TO P STEP -1
    N(I + 1) = N(I)
NEXT
N(P) = A

FOR I = 1 TO 11
    PRINT N(I)
NEXT

note:-you can increase the number of digit during input

No comments:

Post a Comment