#include <stdio.h>
#include <math.h>
main() {
char ss[10],mm[10];
long aa=0,bb=0,cc=0;
int i,j;
printf("please enter two varchar");
scanf("%s %s",ss,mm);
for(i=0;i<strlen(ss);i++) {
aa=aa+(ss[i]-48)*(long)pow(10,strlen(ss)-i-1);
}
for(j=0;j<strlen(mm);j++) {
bb=bb+(mm[i]-48)*(long)pow(10,strlen(mm)-j-1);
}
cc=aa+bb;
printf("%ld",cc);
}
说明:
一:pow是c语言math.h下的函数
语法:double pow(x,y)
用途:x的y次方
二:程序中ss[i]-48是等于ss[i]-'0'的----字符0的assii编码是48