21 13 “=>”2+1=3, 1+3=4 ,3+4=7;
#include
#include
int main()
{
int n,i,sum,k,t;
char a[101],b[101];
scanf("%d\n",&n);
while(n--)
{
sum=0;
scanf("%s%s",a,b);
k=strlen(a);
t=strlen(b);
for(i=0;i
for(i=0;i
printf("%d\n",sum);
}
return 0;
}
字符串處理只要每個數字都加起來,和就為所求結果:99 72
#include
int main()
{
int n, c, i;
for(scanf("%d\n", &n); n--; printf("%d\n", i))
for(i = 0; (c = getchar()) != '\n'; i += (c - 32 ? c - '0' : 0));
return 0;
}