title: C++ sum of odd digit
body: <p>I have created a program in which the function can add all the odd digits; however, I would like print out all the odd digits, for example, sum_odd_digits(2139) return 1+3+9 = 13 while sum_odd_digits(1024) return 1.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int sum_odd_digits(unsigned int i){
        unsigned int a =0;
        while ((i !=0)&amp;&amp;(i%2 !=0)){
        a +=i%10;
        i/=10; 
  } 
       cout &lt;&lt; a;
  }
  int main(){
       sum_odd_digits(2139);
  }
  </code></pre>
  
  <p>Anyone can give me some tips for printing out odd digits?
  Thanks for your help</p>