#include <iostream>
using namespace std;
int digit_sum(int n){
if(n == 0) return 0;
return n%10 + digit_sum(n/10);
}
int main()
{
int n;
while(cin>>n){
cout<<digit_sum(n)<<endl;
}
return 0;
}
Subscribe to:
Post Comments (Atom)
All rights reserved||Using Deluxe Template By Klodian
No comments:
Post a Comment