Solução: Problema da simplificação das frações (Bruno Barbosa)
From AdonaiMedrado.Pro.Br
Revision as of 12:13, 6 June 2009 by 189.104.127.213 (Talk)
#include <stdio.h> int analisaImprime(int num, int x, int y); int analisaImprime(int i, int x, int y){ while((x%i!=0)||(y%i!=0)){ i--; } if((x%i == 0)&&(y%i==0)) printf("%d %d\n", x/i, y/i); else printf("%d %d\n", x, y); } int main(){ int n, m; scanf("%d %d", &n, &m); while(n || m){ if(!n || !m) printf("%d %d\n", n, m); else analisaImprime(n, n, m); scanf("%d %d", &n, &m); } }