0

Hello again everyone. I've been trying to finish this code that calculates the eigen digit (i.e. 2349 is 2+3+4+9=18=1+8=9. It wont give me a single answer though. And we are supposed to do it through a recursive function. The code looks like this:

```
#include <iostream>
using namespace std;
int calcDigit1(int,int);
int main(){
int n;
cout<<"input a number greater than zero:"<<endl;
cin>>n;
cout<<"The eigen digit of this numberis:"<<calcDigit1(n,1)<<endl;
}
int calcDigit1(int n,int a){
if(n<=0)
return a;
return calcDigit1(n%10,a+n);
}
```

I dont understand what is wrong with it, so your help is greatly appreciated. And please keep in mind that i am a complete beginner at this.