title: C++ program in which, read a six digit integer as input from user and output each of its digit in words by for/ While loop
body: <p>/Write a C++ program in which, read a six digit integer as input from user and output each of its digit in words by using loop./</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  int main()
  {
      int number, last_number, count = 0;
      cout &lt;&lt; &quot;Please enter a six digit number:&quot; &lt;&lt; endl;
      cin &gt;&gt; number;
  
      while (count &lt; 6)
      {
  
           last_number = number % 10;
  
  
          if (last_number == 0)
              cout &lt;&lt; &quot;Zero &quot;;
          else if (last_number == 1)
              cout &lt;&lt; &quot;One &quot;;
          else if (last_number == 2)
              cout &lt;&lt; &quot;Two &quot;;
          else if (last_number == 3)
              cout &lt;&lt; &quot;Three &quot;;
          else if (last_number == 4)
              cout &lt;&lt; &quot;Four &quot;;
          else if (last_number == 5)
              cout &lt;&lt; &quot;Five &quot;;
          else if (last_number == 6)
              cout &lt;&lt; &quot;six &quot;;
          else if (last_number == 7)
              cout &lt;&lt; &quot;Seven &quot;;
          else if (last_number == 8)
              cout &lt;&lt; &quot;Eight &quot;;
          else if (last_number == 9)
              cout &lt;&lt; &quot;Nine &quot;;
  
  
          number = number / 10;
          count++;
  
  
      }
      cout &lt;&lt; endl;
      return 0;
  
  }
  </code></pre>
  <p>when i run the program it output opposite values e.g I want to print 123456 instead of outputting one two three four five six it outputs six five four three two one. How do i fix this?</p>