#include<stdio.h>
int main()
{
int n,m,a,b,c;
printf("请输入分子和分母:\n");
scanf("%d%d",&n,&m);
a=n;
b=m;
if(n>m)
{
do
{
c=a%b;
a=b;
b=c;
}while(c!=0);
n=n/a;
m=m/a;
}
else
{
do
{
c=b%a;
b=a;
a=c;
}while(c!=0);
n=n/b;
m=m/b;
}
printf("%d/%d\n",n,m);
return 0;
}
嘻嘻!over
时间: 2024-12-19 18:49:27