CLS
DIM la(1 TO 5) AS INTEGER
FOR i = 1 TO 3
INPUT "enter the value ", la(i)
NEXT i
PRINT "array elements before insertion"
FOR j = 1 TO 3
PRINT la(j);
NEXT j
LET j = 3
LET k = 2
item = 5
WHILE (j >= k)
la(j + 1) = la(j)
j = j - 1
WEND
la(k) = item
n = n + 1
PRINT "array elements after insertion"
FOR k = 1 TO 4
PRINT la(k);
NEXT k
END
PROGRAM RESULT
DIM la(1 TO 5) AS INTEGER
FOR i = 1 TO 3
INPUT "enter the value ", la(i)
NEXT i
PRINT "array elements before insertion"
FOR j = 1 TO 3
PRINT la(j);
NEXT j
LET j = 3
LET k = 2
item = 5
WHILE (j >= k)
la(j + 1) = la(j)
j = j - 1
WEND
la(k) = item
n = n + 1
PRINT "array elements after insertion"
FOR k = 1 TO 4
PRINT la(k);
NEXT k
END
PROGRAM RESULT
0 Comments
If you have further concerns, kindly drop a comment.