PROGRAM CHU7_2;
VAR I,J,F:INTEGER;
A:ARRAY[1..8]OF INTEGER;
BEGIN
FOR I:=1 TO 8 DO
BEGIN
F:=I MOD 2;
IF F=0 THEN A[I]:=0
ELSE A[I]:=1;
FOR J:=1 TO I DO
IF F=0 THEN A[I]:=A[I]+J
ELSE A[I]:=A[I]*J
END;
FOR I:=1 TO 8 DO
WRITE(A[I]:5);
END. 输出:1 3 6 10 120 21 5040 36
|