比较基础
数位之和
http://www.nowcoder.com/questionTerminal/5e85cc26475449648e668aa98e92d05b
/数位和/
#include<cstdio>
#include<iostream>
using namespace std;
const int maxn = 100;
int main()
{
int n;
int num = 0;
int a[maxn];
cin>>n;
do{
a[num++] = n%10;
n = n/10;
}while(n!=0);</iostream></cstdio>
int sum = 0; for(int i = num-1; i>=0; i--) { sum = sum + a[i]; } cout<<sum<<endl;
}