
21.12.2015, 18:58
|
Активный
|
|
Регистрация: 04.12.2007
Адрес: Москва
Сообщения: 234
Версия Delphi: Delphi 7
Репутация: 40
|
|
Вдруг еще актуально )))
Код:
program mul;
{$APPTYPE CONSOLE}
{$D+,O-}
uses
SysUtils,
Math;
const
ARRAY_LEN = 20;
var
Data: array [1..ARRAY_LEN] Of Integer;
i : Integer;
Mult: Integer;
F : TextFile;
begin
{ TODO -oUser -cConsole Main : Insert code here }
Randomize;
Mult := 1;
for i := Low(Data) to High(Data) - 1 do begin
Data[i] := Floor(Random(100));
Writeln(Format('%2d) %5d', [i, Data[i]]));
if Data[i] mod i = 0 then
Mult := Mult * Data[i];
end;
AssignFile(F, ChangeFileExt(ParamStr(0), '.txt'));
Rewrite(F);
Writeln(F, Mult);
CloseFile(F);
Readln;
end.
|