Arfizato

palindrome ama integer

Apr 30th, 2020
571
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // https://imgur.com/a/1jvRLYn
  2. Program pralindrom_m7achech;
  3. uses WinCrt;
  4. var
  5.     x: Word;
  6.     Function mult(x : word): word;
  7.         var
  8.             d : Word;
  9.         begin
  10.             d:=1;
  11.             repeat
  12.                 x:=x div 10;
  13.                 d:=d*10;
  14.             until x = 0;
  15.             mult:=d div 10;
  16.         end;
  17.     Function palin(x : Word):Boolean;
  18.         begin
  19.             while (x <> 0) and (x   div mult(x) = x mod 10)  do
  20.                  x:=(x mod mult(x)) div 10;
  21.             palin:= x = 0;
  22.         end;
  23. begin
  24.     readln(x);
  25.     write(palin(x));
  26. End.
RAW Paste Data