Ответ:
Объяснение:
const
max_elements = 1000;
a = 1;
b = 15;
first_file_name = '1.txt';
second_file_name = '2.txt';
var
i, j, n, r:integer;
p:real;
ar:array[1..max_elements] of integer;
f1, f2:text;
begin
randomize;
writeln('Input n = ');
readln(n);
for i:=1 to n do begin
ar[i]:=random(b-a+1)+a;
end;
assign(f1, first_file_name);
rewrite(f1);
writeln(f1, ar[i]);
close(f1);
assign(f2, second_file_name);
rewrite(f2);
p:=1;
for j:=1 to i do
p:=p*ar[j];
writeln(f2, p:0:0);
close(f2);
readln;
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
Объяснение:
const
max_elements = 1000;
a = 1;
b = 15;
first_file_name = '1.txt';
second_file_name = '2.txt';
var
i, j, n, r:integer;
p:real;
ar:array[1..max_elements] of integer;
f1, f2:text;
begin
randomize;
writeln('Input n = ');
readln(n);
for i:=1 to n do begin
ar[i]:=random(b-a+1)+a;
end;
assign(f1, first_file_name);
rewrite(f1);
for i:=1 to n do begin
writeln(f1, ar[i]);
end;
close(f1);
assign(f2, second_file_name);
rewrite(f2);
for i:=1 to n do begin
p:=1;
for j:=1 to i do
p:=p*ar[j];
writeln(f2, p:0:0);
end;
close(f2);
readln;
end.