Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
389 B
2
Indexable
Never
#include<bits/stdc++.h>
using namespace std;

int sum(int a,int b,int c){
    if(c>1 && c<=9){
        return c;
    }
    else{
       return sum(a,b,c);
    }
}

int main(){
    int n,m,s=0;
    cin>> n;
//    if(n>=0 && n<=9){
//        cout<<n<<endl;
//    }
    /*else{*/
    m=n%10;
    s=s+m;
    n=n/10;
    cout<< sum(n,m,s)<<endl;
    /*}*/
return 0;
}