Hi mates. I'm new at programming, I've tried to make a program that return 1 if a situation is true otherwise 0, but quitting the function "encaixa", the returning to the main fuction is garbage. I have no clue what's wrong...Below my code:

Code:
#include<stdio.h>
#include<stdlib.h>

int encaixa(int x, int y);

int main()
{
	int a, b, ma, me;

	do
	{

		printf("Entre com um inteiro positivo: \n");	
		scanf("%d", &a);

		if(a < 0)
			printf("O número deve ser positivo\n");
	}while(a < 0);

	do
	{
		printf("Entre com outro inteiro positivo: \n");
		scanf("%d", &b);

		if(b < 0)
			printf("O número deve ser positivo\n");
	}while(b < 0);

	

	if(a >= b){
		ma = a;
		me = b;
	}
	else{
		ma = b;
		me = a;
	}

	printf("%d\n", encaixa(ma, me));	
	return 0;
}
	
	int encaixa(int x, int y)
	{

		if(x == y)
			return 1;

		else if(x % 10 == y % 10)
			encaixa(x / 10, y / 10);
		
		else if(y == 0){
			printf("%d\n", y);
			return 1;
			
		}
		else{
			printf("%d\n", y);
			return 0;
			
		}
	}
Thanks in advance