数位之和
数位之和
http://www.nowcoder.com/questionTerminal/5e85cc26475449648e668aa98e92d05b
include<stdio.h>
main()
{int n,sum=0;
scanf("%d",&n);
while(n)
{sum+=n%10;
n/=10;}
printf("%d",sum);}
数位之和
http://www.nowcoder.com/questionTerminal/5e85cc26475449648e668aa98e92d05b
main()
{int n,sum=0;
scanf("%d",&n);
while(n)
{sum+=n%10;
n/=10;}
printf("%d",sum);}
相关推荐