10 CLS
20 N = 10
30 DIM A(1 TO N) AS INTEGER
40 A(1) = 7
50 A(2) = 3
60 A(3) = 3
70 A(4) = 4
80 A(5) = 5
90 A(6) = 6
100 A(7) = 7
110 A(8) = 10
120 A(9) = 9
130 A(10) = 8
140 FOR I = 1 TO N
    150 PRINT A(I)
160 NEXT I
170 LET COUNT = 0
180 FOR K = 1 TO (N - 1)
    190 LET PTR = 1
    200 WHILE (PTR <= N - K)
        210 IF A(PTR) > A(PTR + 1) THEN
            220 HOLDER = A(PTR)
            230 A(PTR) = A(PTR + 1)
            240 A(PTR + 1) = HOLDER
            250 LET COUNT = COUNT + 1
        260 END IF
        270 LET PTR = PTR + 1
    280 WEND
290 NEXT K


300 PRINT "ELEMENTS AFTER SORTING"
310 FOR J = 1 TO N
    320 PRINT A(J)
330 NEXT J
340 PRINT "NUMBER OF SWAPPING IS", COUNT
350 LET FACTORIAL = 1
360 FOR P = 1 TO COUNT
    370 IF (P <= COUNT) THEN
        380 FAC = FACTORIAL * P
    390 END IF
    400 LET FACTORIAL = FAC
410 NEXT P
420 PRINT "FACTORIAL OF", COUNT, "IS", FACTORIAL

430 END

PROGRAM RESULT