.


5


, . 5. : 24681012... . 1971- ?

9. .

. , . , 356428 , :

3 + 5 + 6 = 4 + 2 + 8 =14.

,

[100000; 999999].

.

: - , (sum number - ):

Procedure sum_number(p : longint; var

s : longint);

begin

s := 0;

while p <> 0 do

begin

s := s + p mod 10;

p := p div 10

end

end;

- , , sum_number, (happiness - ):

Procedure happiness(x : longint);

var

l, r : longint;

begin

sum_number(x mod 1000, l);

sum_number(x div 1000, r);

if l = r then write(x,' ')

end;

x mod 1000 - , x div 1000 - .

Program

Problem9; { }

uses WinCrt;

var

i : longint;

{----------------------------------------------------------------------------------------}

Procedure sum_number(p : longint; var s : longint);

begin

s := 0;

while p <> 0 do

begin

s := s + p mod 10;

p := p div 10

end