Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
519 B
2
Indexable
Never
#include<stdio.h>
#include<string.h>
char num2[25],num1[25];
int ans[25],bry[25];

int main(){
	while(scanf("%s",num1)!=EOF){
		scanf("%s",num2);
		int tmp=0;
		memset(ans,0,sizeof(ans));
		for(int i=strlen(num1)-1;i>=0;i--){
			ans[tmp]=num1[i]-'0';
			tmp++;
		}
		tmp=0;
		for(int i=strlen(num2)-1;i>=0;i--){
			ans[tmp]+=num2[i]-'0';
			tmp++;
		}
		for(int i=0;i<=19;i++){
			if(ans[i]>9){
				ans[i+1]+=ans[i]/10;
				ans[i]%=10;
			}
		}
		for(int i=19;i>=0;i--){
			printf("%d",ans[i]);
		}
		printf("\n");
	}
}