现有不定组数的数据,每组有两个整数(int型),如果第一个数是第二个数的尾数,则输出1,表示匹配,否则输出0。
input
多行,每行两个正整数。
output
多行,每行一个数,或者0,或者1。
sample input
123 45123
122 122333
sample output
1
0
#include <stdio.h>
int main()
{
int m,n;
while(scanf("%d %d",&m,&n) != EOF)
{
while(m>0 && n>0)
{
if(m%10 != n%10)
break;
m = m/10;
n = n/10;
}
if(m==0 && n>=0)
printf("1\n");
else
printf("0\n");
}
return 0;
}