Вот тебе в паскале
program ryad_chisel;
var N, t:integer;
begin
read(N);
t:=(N*(N+1))div 2;
if t mod 2 =1 then writeln('IMPOSSIBLE')
else begin
if N mod 2 =0 then begin
t:=N div 4;
repeat
write('+');
t:=t-1;
until t=0;
t:=N div 2;
repeat
write('-');
t:=t-1;
until t=0;
t:=N div 4;
repeat
write('+');
t:=t-1;
until t=0;
end
else begin
t:=((N+1) div 4)-1;
repeat
write('+');
t:=t-1;
until t=0;
t:=((N-1) div 2)+1;
repeat
write('-');
t:=t-1;
until t=0;
t:=(N+1) div 4;
repeat
write('+');
t:=t-1;
until t=0;
end
end
end.
Var
N,A:integer;
Begin
Write('N = ');Read(N);
A:=0;
While N>0 do
Begin
if (N mod 10) > A then A:= N mod 10;
N:=N div 10;
End;
Write(A)
End.
Var
N,A,B:integer;
C:boolean;
Begin
Write('N = ');Read(N);
A:=-1;
B:=-2;
C:=false;
While N>0 do
Begin
if A=B then C:=true;
if N>0 then
Begin
A:=N mod 10;
N:=N div 10;
End;
if A=B then C:=true;
if N>0 then
Begin
B:=N mod 10;
N:=N div 10;
End;
End;
if A=B then C:=true;
if C then Write('Есть')
else Write('Нет')
End.
Подробнее - на -