title: Reverse numeral input
body: <p>I'm trying to get my code to print out the reverse of whatever integer is input. No errors, just not printing out correctly. What am I doing wrong?</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;conio.h&gt;
  
  using namespace std;
  
  int num, n;
  int reverse(int);
  
  int main()
  {
      cout &lt;&lt; "Enter a number less than 1000 to be reversed:" &lt;&lt; endl;
      cin &gt;&gt; num;
      reverse(num);
      cout &lt;&lt; "reversed number is:";
      getch();
      return 0;
  }
  
  int reverse(int num)
  {
      long sum=0;int rem;
  
      while(n&gt;0)
      {
          rem=n%10;
          sum=sum*10+rem;
          n=n/10;
          cout &lt;&lt; sum &lt;&lt; endl;
      }
  
      return sum;
      cout &lt;&lt; sum &lt;&lt; endl;
  }
  </code></pre>