[mw_shl_code=c,true]#include <stdio.h>
void main()
{
char a[256];
int b = 0,temp = 0,strlong = 0;
int i = 0;
printf("请输入字符串:");
gets(a);
strlong = strlen(a);
i = strlong;
i-=1;
while(i>=0)
{
temp = a;
temp-=48;
b+=temp;
i--;
if(i<=-1)
{
break;
}
}
printf("结果:%d",b);
getch();
}
[/mw_shl_code] |