#include <stdio.h> #include <string.h> main() { char zf[7],zfa[7]; int a=0,b=0,c=0,len1,len2; gets(zf); gets(zfa); len1=strlen(zf),len2=strlen(zfa); while(a<=len1-1) { b=b*10+(zf[a]-'0'); a++; } a=0; while(a<=len2-1) { c=c*10+(zfa[a]-'0'); a++; } printf("%d",b+c); getchar(); }
#include <stdio.h> #include <string.h> #include <math.h> int fh(char zf[]) { int a=0,b=0; while(a<=strlen(zf)-1) { b=b*10+(zf[a]-'0'); printf("%d\n",b); a++; } return b; } main() { char zf[7],zfa[7]; int a=0,b=0,c=0,len1,len2; gets(zf); gets(zfa); printf("%d",fh(zf)+fh(zfa)); getchar(); }
标签:数字,len2,求和,zf,C语言,int,zfa,include From: https://www.cnblogs.com/xkdn/p/17067590.html