title: Inverse of a number, c++
body: <p>i'm creating a program that displays the inverse of a number using the method:</p>
  
  <p><strong><em>Example</em></strong>:<br></p>
  
  <pre><code>123 ==&gt; 3*10^2 + 2*10^1 + 1*10^1 = 321
  </code></pre>
  
  <p>But the output is always 0. Any help?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int power(int a)
  {
      int i;
      int x = 1;
      for (i = 1; i = a; i++)
      {
          x = x * 10;
      }
      return x;
  }
  
  int inv(int b)
  {
      int z = b, j = 0, s = 0, y;
  
      for (z = b; z = 0; z = z / 10)
      {
          for (y = z; y = 0; y = y / 10)
          {
              j++;
          }
          s = s + (z % 10)*power(j - 1);
      }
      return s;
  }
  
  
  int main()
  {
      printf("please enter a number"); int n;
      scanf("%d", &amp;n);
      printf("%d", inv(n));
      return 0;
  }
  </code></pre>