10 CLS
20 LET N = 7
30 FOR J = 1 TO N
40 INPUT "ENTER A VALUE: ", LA(J)
50 NEXT J
60 PRINT “ARRAY ELEMENTS BEFORE INSERTION”
70 FOR I = 1 TO N
80 PRINT LA(I);
90 NEXT I
100 LET J = 7
110 LET K = 6
120 ITEM = 25
130 LA(9) = 20
140 WHILE (J >= K)
150 LA(J + 1) = LA(J)
160 J = J – 1
170 WEND
180 LA(K) = ITEM
190 PRINT “”
200 PRINT “ARRAY ELEMENTS AFTER INSERTION”
210 FOR K = 1 TO 9
220 PRINT LA(K);
230 NEXT K
240 LET SUM = 0
250 FOR J = 1 TO 9
260 LET FACTORIAL = 1
270 FOR P = 1 TO LA(J)
280 IF (P <= LA(J)) THEN
290 FA = FACTORIAL * P
300 END IF
310 LET FACTORIAL = FA
320 NEXT P
330 SUM = SUM + FA
340 NEXT J
350 PRINT LA(J), “THE SUM OF THE FACTORIAL OF ALL THE ELEMENTS IS”, SUM
360 END
PROGRAM RESULT
0 Comments
If you have further concerns, kindly drop a comment.