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.
Const N = 3; M = 4; Var T:array[1..N,1..M] of integer; i,j:integer; Begin Randomize; WriteLn('Было:'); For i:= 1 to N do Begin For j:= 1 to M do Begin T[i,j]:=random(3000); Write(T[i,j]:6,' '); if (99 < T[i,j])and(T[i,j]<1000)and(T[i,j] mod 7 = 0) then T[i,j]:=T[i,j]-10; End; WriteLn End; WriteLn('Стало:'); For i:= 1 to N do Begin For j:= 1 to M do Write(T[i,j]:6,' '); WriteLn End; End.
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.
Пример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
N = 3;
M = 4;
Var
T:array[1..N,1..M] of integer;
i,j:integer;
Begin
Randomize;
WriteLn('Было:');
For i:= 1 to N do
Begin
For j:= 1 to M do
Begin
T[i,j]:=random(3000);
Write(T[i,j]:6,' ');
if (99 < T[i,j])and(T[i,j]<1000)and(T[i,j] mod 7 = 0) then T[i,j]:=T[i,j]-10;
End;
WriteLn
End;
WriteLn('Стало:');
For i:= 1 to N do
Begin
For j:= 1 to M do
Write(T[i,j]:6,' ');
WriteLn
End;
End.
Было:
2280 893 1825 21
491 97 666 402
1961 2639 1873 1069
Стало:
2280 893 1825 21
491 97 666 402
1961 2639 1873 1069