/* This code works when the added chracter's value is less than or equal to 9. I mean when there is a carry,what will i do to print that. And there should not be used any library function. Run the program and you will understand clearly. */
#include "stdafx.h"
int strlen(char str[]);
int main()
{
int i=0,len1,len2,max,min,j=0,k=0,l=0;
char num1[30],num2[30],ans[50];
gets_s(num1);
gets_s(num2);
len1=strlen(num1);
len2=strlen(num2);
if(len1>len2)
{
max=len1;
min=len2;
}
else
{
max=len2;
min=len1;
}
while(num1[i]!='\0')
i++;
j=max-1;
while(j>=0)
{
num1[j]=num1[i-1];
i--;
if(i<0)
num1[j]=48;
j--;
}
while(num2[k]!='\0')
k++;
l=max-1;
while(l>=0)
{
num2[l]=num2[k-1];
k--;
if(k<0)
num2[l]=48;
l--;
}
for(i=max-1;i>=0;i--)
ans[i]=num1[i]+num2[i]-48;
for(i=0;i<max;i++)
printf("%c",ans[i]);
printf("\n");
return 0;
}
int strlen(char str[])
{
int len=0;
while(str[len]!='\0')
len++;
return len;
}