title: Creating a c++ program to double and triple the number of integers based on whether they are odd or even
body: <p>I am looking for help with a program that will take any number of digits in an integer and if the number is odd then it will double each integer. If the number is even it will triple each integer. Ex. 123 = 112233 or 122 = 111222222. I looking for a way to take the formula I have an run it for any amount of numbers.  Here is what I have so far:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  using namespace std;
  
  int main()
  {
      int num1, answer;
      cin &gt;&gt; num1;
      answer = num1 % 2;
  
      if (answer == 1)
      {
          cout &lt;&lt; num1 % 1000/100 &lt;&lt; num1 % 1000/100 &lt;&lt; num1 % 100/10 &lt;&lt; num1 % 100/10 &lt;&lt; num1 % 10 &lt;&lt; num1 % 10;
      }
  
          else if (answer == 0)
          {
              cout &lt;&lt; num1 % 1000/100 &lt;&lt; num1 % 1000/100 &lt;&lt; num1 % 1000/100 &lt;&lt; num1 % 100/10 &lt;&lt; num1 % 100/10 &lt;&lt; num1 % 100/10 &lt;&lt; num1 % 10 &lt;&lt; num1 % 10 &lt;&lt; num1 %10;
          }
  
      cout &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  
  <p>As of right now it will only do numbers that are 3 digits in length. Is there a way to do these formulas for any number?</p>