#include <stdio.h>

main()
{
int n,d,t;
 clrscr();
 printf("escreva o numerador e o denominador\n");
 scanf("%d%d",&n,&d);
 t=MDC(n,d);
	while(n/t!=0 && d/t!=0)
	{
		n=n/t;
		d=d/t;
	}
 printf("o numerador ‚: %d e o denominador ‚: %d",n,d);
 getch();
}

MDC(int n, int d)
{
int a, b, x, i, t;
	if(n>=d)
	{
		a=n;
		b=d;
	}
	else
	{
		a=d;
		b=n;
	}
 x=1;
 i=1;
 while(x!=0)
 {
 i++;
	if(a%i==0 && b%i==0)
	{
		x=0;
		t=i;
	}
 }return t;
}


