title: palindrome of number in C
body: <pre><code>#include&lt;stdio.h&gt;
  
  int main(void)
  {
   int rev=0,temp=0,frwd,n,ans=0;
   int i,j;
      for(i=100;i&lt;=999;i++)
      {   
          for(j=i;j&lt;=999;j++)
          {
              n = i*j;
          frwd = n;
          while(n!=0)
          {   
  
              temp = n%10;
              n = n/10;
              rev = temp+rev*10;
  
          }       
          printf("%d",rev);       
          if((rev == frwd)&amp;&amp;(ans&lt;frwd))
          {
              ans=frwd;
              printf("%d",ans);
          }
          }
      }
  return(0);
  }
  </code></pre>
  
  <p>I have tried working out everything but this code doesn't seem to give the correct output.
  The desired output is largest palindrome number of 6 digits.
  If I am running the individual parts i.e. the reversing of number , checking of number whether or not it is a palindrome or the for loops, they are working fine but in the program they are giving garbage as output.
  Any help would be appreciated.    </p>