#include "stdio.h" #include "string.h" int main() { char s1[100],s2[100]; int m,n; int c,i,k; int oper1[100]={0},oper2[100]={0}; gets(s1); gets(s2); m = strlen(s1); n = strlen(s2); (m > n? k = m : k = n); c = k; for(i=0;i<m;i++) oper1[k--] = s1[m-1-i] - '0'; for(i=0,k=c;i<n;i++) oper2[k--] = s2[n-1-i] - '0'; for(i=c;i>=0;i--) { oper1[i] += oper2[i]; if(oper1[i]>=10) { oper1[i] -= 10; oper1[i-1]++; } } for((oper1[0]>0? i=0:i=1);i<=c;i++) printf("%d",oper1[i]); }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题10.2 (C语言代码)浏览:689 |
程序员的表白 (C语言代码)浏览:1462 |
不会做的浏览:954 |
数组输出 (C语言代码)错误???浏览:602 |
输出正反三角形 (C语言代码)浏览:859 |
A+B for Input-Output Practice (III) (C语言代码)浏览:594 |
A+B for Input-Output Practice (V) (C语言代码)浏览:497 |
C二级辅导-进制转换 (C语言代码)浏览:750 |
2006年春浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:726 |
理财计划 (C语言代码)浏览:494 |