title: From C to GMP implementation
body: <p>I would ask you how this code written in c would look in GMP. I tried something to write but the library is hard to understand. I don't know how to write operation: <code>r = r*10 + n%10;</code> in gmp. I would be very grateful for help.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;stdbool.h&gt;
  #include &lt;gmp.h&gt;
  
  long long rev(long long n)
  {
      long long r = 0;
      while (n &gt; 0)
      {
          r = r*10 + n%10;
          n = n/10;
      }
      return r;
  }
  
  bool palindrome(long long n)
  {
      return (rev(n) == n);
  }
  
  void reverseAdd(long long n)
  {
      long long r=0;
      while (n &lt;= 100000000000000)
      {
          r = rev(n);
          printf("stage: %lld + %lld\n",n,r); 
  
          n = n + r;
  
          if (palindrome(n))
          {
              printf("Palindrom: %lld\n",n);
              break;
          }
          else if (n &gt; 100000000000000)
          {
              printf("Not a palindrome\n");
          }
      }
  }
  
  
  int main()
  {
      long long l;
  
      printf("Give the number to analyze:");
      scanf("%lld",&amp;l);
      reverseAdd(l);
      return 0;
  }
  </code></pre>