View Code of Problem 66

#include<stdio.h>
#include<math.h>
int main(){
	int a,b;
	int c,d,f;
	while(scanf("%d %d",&a,&b)!=EOF){
		d=b;
		f=a;
		if(a==b){
			c=1;
			printf("%d\n",c);
		}else{
			while(b!=0){
				c=a%b;
				a=b;
				b=c;
			}
			printf("%d/%d\n",f/a,d/a);
		}
		
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 66