SlepoiKrot

Untitled

Dec 25th, 2017
70
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program C;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6. SysUtils;
  7. var
  8. s, x, f, x1: integer;
  9. begin
  10. readln (x);
  11. x1 := x;
  12. s := 0;
  13. while (x <> 0) do begin
  14. s := s + x mod 10;
  15. x := x div 10;
  16. end;
  17. if (odd(s)) then
  18. if (s * s <> x1) then
  19. writeln (s * s)
  20. else
  21. writeln (-1)
  22. else
  23. writeln (x1);
  24. readln;
  25. readln;
  26. end.
RAW Paste Data