10 CLS
20 LA(1) = 1
30 LA(2) = 2
40 LA(3) = 3
50 LA(4) = 4
60 LA(5) = 5
70 LA(6) = 6
80 LA(7) = 7
90 PRINT "ARRAY ELEMENTS BEFORE INSERTION"
100 FOR J = 1 TO 7
110 PRINT LA(J);
120 NEXT J
130 LET J = 7
140 LET K = 3
150 ITEM = 3
160 WHILE (J >= K)
170 LA(J + 1) = LA(J)
180 J = J - 1
190 WEND
200 LA(K) = ITEM
210 PRINT ""
220 PRINT "ARRAY ELEMENTS AFTER INSERTION"
230 FOR K = 1 TO 8
240 PRINT LA(K);
250 NEXT K
260 PRINT ""
270 PRINT "THE ODD NUMBERS IN THE ARRAY ARE"
280 LET SUM = 0
290 FOR J = 1 TO 8
300 IF (LA(J) MOD 2 <> 0) THEN
310 PRINT LA(J);
320 SUM = SUM + LA(J)
330 END IF
340 NEXT J
350 PRINT ""
360 PRINT "THE SUM OF THE ODD NUMBERS IS: ", SUM
370 END
PROGRAM RESULT
0 Comments
If you have further concerns, kindly drop a comment.