#include<stdio.h>
#include<string.h>
char c[100],r[100];;
void anik(char s[100])
{
static int c = 0;
if(c = 0)
{
strcpy(r,s);
}
else
{
int n, m, i = 0, y = 0, o = 0, t, x = 0;
strrev(r), strrev(s);
n = strlen(r), m = strlen(s);
while(m>i || n>i)
{
if(s[i]>=48 && s[i]<=57)
{
x = s[i] - 48;
}
if(r[i]>=48 && r[i]<=57)
{
o = r[i] - 48;
}
t = x + o + y;
c[i] = t%10 + 48;
y = t/10;
x=0;
o=0;
i++;
}
if(y>0)
{
c[i] = y + 48;
i++;
}
c[i] = '\0';
strrev(c);
strcpy(r,c);
c++;
}
}
int main()
{
char a[100];
int z = 100;
while(z>=1)
{
gets(a);
if(a[0] == '0')
{
break;
}
anik(a);
z--;
}
printf("%s\n", c);
return 0;
}
#include<string.h>
char c[100],r[100];;
void anik(char s[100])
{
static int c = 0;
if(c = 0)
{
strcpy(r,s);
}
else
{
int n, m, i = 0, y = 0, o = 0, t, x = 0;
strrev(r), strrev(s);
n = strlen(r), m = strlen(s);
while(m>i || n>i)
{
if(s[i]>=48 && s[i]<=57)
{
x = s[i] - 48;
}
if(r[i]>=48 && r[i]<=57)
{
o = r[i] - 48;
}
t = x + o + y;
c[i] = t%10 + 48;
y = t/10;
x=0;
o=0;
i++;
}
if(y>0)
{
c[i] = y + 48;
i++;
}
c[i] = '\0';
strrev(c);
strcpy(r,c);
c++;
}
}
int main()
{
char a[100];
int z = 100;
while(z>=1)
{
gets(a);
if(a[0] == '0')
{
break;
}
anik(a);
z--;
}
printf("%s\n", c);
return 0;
}
Comments
Post a Comment