Const
N = 4;
Var
A:array[1..N,1..N] of integer;
i,j,k:integer;
Begin
Randomize;
WriteLn('1)');
k:=0;
For i:= 1 to N do
Begin
For j:= 1 to N do
Begin
A[i,j]:=random(21)-10;
Write(A[i,j]:3,' ');
if A[i,j] < 0 then k:=k+1;
End;
WriteLn
End;
WriteLn('k = ',k);
WriteLn('2)');
For i:= 1 to N do
Begin
For j:= 1 to N do
Begin
if j > i then A[i,j]:=100;
Write(A[i,j]:3,' ')
End;
WriteLn
End;
WriteLn('3)');
For i:= 1 to N div 2 do
Begin
For j:= 1 to N do
Begin
k:=A[i+N div 2,j];
A[i+N div 2,j]:=A[i,j];
A[i,j]:=k;
End
End;
For i:= 1 to N do
Begin
For j:= 1 to N do
Write(A[i,j]:3,' ');
WriteLn
End;
End.
1)
10 2 -9 4
-10 5 -5 -10
4 9 4 10
3 -9 10 -6
k = 6
2)
10 100 100 100
-10 5 100 100
4 9 4 100
3 -9 10 -6
3)
4 9 4 100
3 -9 10 -6
10 100 100 100
-10 5 100 100
Var
ch, mo, di: longint;
otvet, s: string;
begin
readln(ch);
otvet := '';
while ch <> 0 do
begin
di := ch div 8;
mo := ch mod 8;
str(mo, s);
otvet := s + otvet;
ch := di;
end;
writeln(otvet);
end.
Программа для резервного копирования данных на системный диск.
Const n=4; m=5;
var a:array[1..n,1..m] of integer;
i,j:integer;
begin
for i:=1 to n do
begin
for j:=1 to m do
begin
a[i,j]:=random(1000);
write(a[i,j]:4);
end;
writeln;
end;
for i:=1 to n do
for j:=1 to m do
if (a[i,j] mod 7=0)and(a[i,j]>99)and(a[i,j]<1000) then a[i,j]:=a[i,j]-10;
writeln('New:');
for i:=1 to n do
begin
for j:=1 to m do write(a[i,j]:4);
writeln;
end;
end.
Пример<span>889 188 17 186 772
394 121 406 679 936
20 147 868 691 450
525 73 575 232 416
New:
879 188 17 186 772
394 121 396 669 936
20 137 858 691 450
515 73 575 232 416
</span>
Исходное число = 47-24 = 23
23+17 = 40
40+36 = 76
Число трехзначное? - нет
76+2587 = 2663
Ответ: 2663