Var ars:array[1..n] of string; i,j,k:integer; begin k:=n; for i:=1 to n do readln(ars[i]); for i:=1 to n do if pos('5',ars[i])<>0 then begin; for j:=i to n-1 do ars[j]:=ars[j+1]; dec(k); end; writeln('Final array:'); for i:=1 to k do writeln(ars[i]); end.
Пример ввода: 3434 5656 6767 5757 8989 Пример вывода: Final array: 3434 6767 8989
const n =30; var s:string; i,k,m:integer; a:array[1..n] of integer; b:array[1..n] of integer; begin for i:=1 to n do readln(a[i]); k:=1 ; for i:=1 to n do begin str(a[i],s); if pos('5',s) = 0 then begin b[k]:= a[i]; k:=k+1; end; end; for i:= 1 to n do a[i]:=b[i]; for i:= 1 to n do write(a[i],' '); end.
Const
n=5;
Var
ars:array[1..n] of string;
i,j,k:integer;
begin
k:=n;
for i:=1 to n do
readln(ars[i]);
for i:=1 to n do
if pos('5',ars[i])<>0 then
begin;
for j:=i to n-1 do
ars[j]:=ars[j+1];
dec(k);
end;
writeln('Final array:');
for i:=1 to k do
writeln(ars[i]);
end.
Пример ввода:
3434
5656
6767
5757
8989
Пример вывода:
Final array:
3434
6767
8989
var
s:string;
i,k,m:integer;
a:array[1..n] of integer;
b:array[1..n] of integer;
begin
for i:=1 to n do
readln(a[i]);
k:=1 ;
for i:=1 to n do
begin
str(a[i],s);
if pos('5',s) = 0 then
begin
b[k]:= a[i];
k:=k+1;
end; end;
for i:= 1 to n do
a[i]:=b[i];
for i:= 1 to n do
write(a[i],' ');
end.