Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program C;
- {$APPTYPE CONSOLE}
- uses
- SysUtils;
- var
- s, x, f, x1: integer;
- begin
- readln (x);
- x1 := x;
- s := 0;
- while (x <> 0) do begin
- s := s + x mod 10;
- x := x div 10;
- end;
- if (odd(s)) then
- if (s * s <> x1) then
- writeln (s * s)
- else
- writeln (-1)
- else
- writeln (x1);
- readln;
- readln;
- end.
RAW Paste Data