C++ count numbers
<p>I have this function:</p>

<pre><code>int calc (int day, int month , int year)
{
    int cal;
    cal=day+month+year;
    cout&lt;&lt;cal;
}
</code></pre>

<p>Let say that the result of <code>cal</code> is 2008. What I want to do is to count each number separately.</p>

<h3>Example:</h3>

<pre><code>2008=2+0+0+8=10
</code></pre>

<p>But I don't know how to do that. Any ideas? </p>

<p>Thanks</p>

<h2>Edit:</h2>

<h3>Another Example:</h3>

<pre><code>day=20
Month=03
Year=1993

20+03+1993=2016

And 2+0+1+6=9
</code></pre>
