int sum_loop(long x)
{
int result=0;
while(x>0)
{
result+=x%10;
x/=10;
}
return result;
}
int sum_recursion(long x)
{
if(x<=0)
return 0;
return sum_recursion(x/10)+x%10;
}
int main()
{
cout<cout< return 0;
}
#include
using namespace std;
int sum_loop(long x)
{
int s=0;
while(x)
{
s+=x%10;
x/=10;
}
return s;
}
int sum_recursion(long x)
{
if(x==0) return 0;
else
return sum_recursion(x/10)+x%10;
}
int main()
{
long x = 2014120213;
cout<
}
一个循环就可以