here's the code in Delphi:

```
function Perfect(x: Integer): Integer;
var
  i, a: Integer;
begin
  i := 1;
  a := 0;

  while i <= x div 2 do
  begin
    if (x mod i = 0) then
      a := a + i;
    i := i + 1;
  end;

  if x = a then
    Result := x;
end;

```

Basically, it's a function that shows [perfect numbers](https://en.wikipedia.org/wiki/Perfect_number) from given interval. I created a loop for to show these numbers but I have a problem because it also shows some random numbers when it's not a perfect number. So let's say I have [1;7] and then console shows that:

```none
1969410929
1969410929
1969410929
1969410929
1969410929
6
1969410929

```

What can I do to show only right numbers?