Найти для массива Cn S=1!С1+2!C2+…+n!Cn и передвинуть элементы на 1 позицию влево — Basic(Бейсик)

INPUT "input array length ", n
DIM M(n) AS INTEGER
RANDOMIZE TIME
FOR i = 1 TO n
        M(i) = RND(3) * 20 - 10
NEXT
sum = 0
current = 1
FOR i = 1 TO n
        current = current * i
        sum = current * M(i) + sum
NEXT
FOR i = 0 TO n
        PRINT M(i);
NEXT
PRINT "sum=", sum

Leave a Comment