3. var x:array[1..10] of real; k:integer; begin write('x[1] = '); readln(x[1]); write('x[2] = '); readln(x[2]); for k:=3 to 10 do x[k]:=sin(x[k-1]-x[k-2])/cos(x[k-1]-x[k-2])+sqrt(abs(sin(x[k-1]))) ;for k:=1 to 10 do write(x[k]:5:2); writeln; end.
4. const n=10; var x:array[1..n] of real; i:integer; s,p:real; begin Randomize; writeln('Массив x:'); for i:=1 to n do begin x[i]:=3*random; write(x[i]:6:2); end; writeln; p:=1; for i:=1 to n do p:=p*x[i]; writeln('p = ',p); s:=1+exp(p); writeln('S = ',s); end.
Пример: Массив x: 1.98 1.38 2.96 2.14 1.64 1.94 2.32 2.74 0.00 2.10 p = 0.371053196230522 S = 2.449260166514
Answers & Comments
Verified answer
3.var x:array[1..10] of real;
k:integer;
begin
write('x[1] = '); readln(x[1]);
write('x[2] = '); readln(x[2]);
for k:=3 to 10 do
x[k]:=sin(x[k-1]-x[k-2])/cos(x[k-1]-x[k-2])+sqrt(abs(sin(x[k-1])))
;for k:=1 to 10 do write(x[k]:5:2);
writeln;
end.
Пример:
x[1] = 1
x[2] = 1
1.00 1.00 0.92 0.81 0.74 0.75 0.84 0.95 1.01 0.98
4.
const n=10;
var x:array[1..n] of real;
i:integer; s,p:real;
begin
Randomize;
writeln('Массив x:');
for i:=1 to n do
begin
x[i]:=3*random;
write(x[i]:6:2);
end;
writeln;
p:=1;
for i:=1 to n do p:=p*x[i];
writeln('p = ',p);
s:=1+exp(p);
writeln('S = ',s);
end.
Пример:
Массив x:
1.98 1.38 2.96 2.14 1.64 1.94 2.32 2.74 0.00 2.10
p = 0.371053196230522
S = 2.449260166514