begin writeln('Задача 1, введите n ='); read(n); for i := 1 to n do if i mod 2 = 0 then x := x + 1 / (2 * i + 1) else x := x - 1 / (2 * i + 1); writeln('Sum = ', x);
writeln('Задача 2, введите a, b, c, d ='); read(a, b, c, d); for i := a to b do if i mod c = d then writeln(i);
writeln('Задача 3, введите n и n чисел ='); read(n); a := 0; b := 0; c := 0; for i := 1 to n do begin read(p); if p = 0 then a := a + 1 else if p < 0 then b := b + 1 else if p > 0 then c := c + 1; end; writeln(a, ' ', b, ' ', c);
writeln('Задача 5, введите x, p ,y ='); read(x, p, y); n := 0; repeat x := round(x * (100 + p)) / 100; n := n + 1; until x >= y; writeln(n, ' лет');
writeln('Задача 6, введите A, B ='); read(a, b); repeat if (a mod 2 = 0) and (a div 2 >= b) then begin writeln(a, ' : 2 = ', a div 2); a := a div 2 end else begin writeln(a, ' - 1 = ', a - 1); a := a - 1; end; until a <= b; end.
Uses crt; const n=4; var b:array[1..n,1..n] of integer; i,j,pr,k,t,min:integer; begin randomize; pr:=1; for i:=1 to n do for j:=1 to n do b[i,j]:=random(100)-50; for i:=1 to n do begin for j:=1 to n do write(b[i,j]:3); writeln; end; writeln; k:=1; t:=3; repeat for i:=k to k do for j:=1 to t do if b[i,j]>0 then pr:=b[i,j]*pr; inc(k); t:=t-1; until k=4; writeln(pr); min:=50; for i:=1 to n do for j:=2 to 2 do if b[i,j]<min then begin min:=b[i,j]; k:=i; t:=j; end; writeln(min); writeln; b[4,3]:=b[4,3]+b[k,t]; b[k,t]:=b[4,3]-b[k,t]; b[4,3]:=b[4,3]-b[k,t]; for i:=1 to n do begin for j:=1 to n do write(b[i,j]:3); writeln; end; writeln; end.
a, b, c, d, i, n, p: integer;
x, y: real;
begin
writeln('Задача 1, введите n =');
read(n);
for i := 1 to n do
if i mod 2 = 0 then
x := x + 1 / (2 * i + 1)
else x := x - 1 / (2 * i + 1);
writeln('Sum = ', x);
writeln('Задача 2, введите a, b, c, d =');
read(a, b, c, d);
for i := a to b do
if i mod c = d then writeln(i);
writeln('Задача 3, введите n и n чисел =');
read(n);
a := 0; b := 0; c := 0;
for i := 1 to n do
begin
read(p);
if p = 0 then a := a + 1
else if p < 0 then b := b + 1
else if p > 0 then c := c + 1;
end;
writeln(a, ' ', b, ' ', c);
writeln('Задача 5, введите x, p ,y =');
read(x, p, y);
n := 0;
repeat
x := round(x * (100 + p)) / 100;
n := n + 1;
until x >= y;
writeln(n, ' лет');
writeln('Задача 6, введите A, B =');
read(a, b);
repeat
if (a mod 2 = 0) and (a div 2 >= b) then begin
writeln(a, ' : 2 = ', a div 2);
a := a div 2
end
else begin
writeln(a, ' - 1 = ', a - 1);
a := a - 1;
end;
until a <= b;
end.
const n=4;
var b:array[1..n,1..n] of integer;
i,j,pr,k,t,min:integer;
begin
randomize;
pr:=1;
for i:=1 to n do
for j:=1 to n do
b[i,j]:=random(100)-50;
for i:=1 to n do
begin
for j:=1 to n do
write(b[i,j]:3);
writeln;
end;
writeln;
k:=1;
t:=3;
repeat
for i:=k to k do
for j:=1 to t do
if b[i,j]>0 then pr:=b[i,j]*pr;
inc(k);
t:=t-1;
until k=4;
writeln(pr);
min:=50;
for i:=1 to n do
for j:=2 to 2 do
if b[i,j]<min then begin min:=b[i,j]; k:=i; t:=j; end;
writeln(min);
writeln;
b[4,3]:=b[4,3]+b[k,t];
b[k,t]:=b[4,3]-b[k,t];
b[4,3]:=b[4,3]-b[k,t];
for i:=1 to n do
begin
for j:=1 to n do
write(b[i,j]:3);
writeln;
end;
writeln;
end.