const
N = 40;
type
Tmas = array[1..N] of integer;
procedure input(var m: Tmas);
var
i: longint;
begin
for i := 1 to N do
readln(m[i]);
end;
procedure change(var m: Tmas);
kol, i: longint;
kol := 0;
if (m[i] mod 3 = 0) and (m[i] mod 10 = 1) then
inc(kol);
if (m[i] mod 3 = 0) and (m[i] mod 10 = 1) and (kol <> 0) then
m[i] := kol;
procedure output(m: Tmas);
write(m[i] + ' ');
m: Tmas;
input(m);
change(m);
output(m);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
const
N = 40;
type
Tmas = array[1..N] of integer;
procedure input(var m: Tmas);
var
i: longint;
begin
for i := 1 to N do
readln(m[i]);
end;
procedure change(var m: Tmas);
var
kol, i: longint;
begin
kol := 0;
for i := 1 to N do
if (m[i] mod 3 = 0) and (m[i] mod 10 = 1) then
inc(kol);
for i := 1 to N do
if (m[i] mod 3 = 0) and (m[i] mod 10 = 1) and (kol <> 0) then
m[i] := kol;
end;
procedure output(m: Tmas);
var
i: longint;
begin
for i := 1 to N do
write(m[i] + ' ');
end;
var
m: Tmas;
begin
input(m);
change(m);
output(m);
end.