I have this function:
int calc (int day, int month , int year)
{
int cal;
cal=day+month+year;
cout<<cal;
}
Let say that the result of cal
is 2008. What I want to do is to count each number separately.
Example:
2008=2+0+0+8=10
But I don't know how to do that. Any ideas?
Thanks
Edit:
Another Example:
day=20
Month=03
Year=1993
20+03+1993=2016
And 2+0+1+6=9