Răspuns:
1)
var
n:integer;
begin
Write('n= '); Readln(n);
for n:=n downto 1 do
begin
if (n mod 3) = 0 then begin
Writeln(n);
break;
end;
end;
end.
2)var
n:array[1..20] of integer;
l:integer;
aux:string;
begin
Write('Scrieti lungimea sirului(cate cifre are sirul)= '); Readln(l);
Write('Scrieti numerele pe rand= '); for var i:=1 to l do Read(n[i]);
for var i:=1 to l do
begin
aux:=IntToStr(n[i]);
if length(aux) = 2 then begin
var aux1,aux2:integer;
aux1:=StrToInt(aux[1]);
aux2:=StrToInt(aux[2]);
if aux1 = aux2 then
Write(aux,' ');
end;
end;
end.
Explicație: