#include<stdio.h>
int gcd(int n,int m)
{
int temp,r;
if(n<m)
{
temp=n;
n=m;
m=temp;
}
while(m!=0)
{
r=n%m;
n=m;
m=r;
}
return n;
}


void main()
{
int a,b;//a是分子 b是分母
printf("please input a and b:");
scanf("%d%d",&a,&b);

printf("%d/%d",a/gcd(a,b),b/gcd(a,b));

}

相关文章:

  • 2021-11-22
  • 2022-02-02
  • 2022-12-23
  • 2021-07-15
  • 2021-08-28
  • 2021-12-10
猜你喜欢
  • 2021-07-28
  • 2021-12-29
  • 2021-06-26
  • 2022-01-28
  • 2021-08-31
  • 2022-12-23
相关资源
相似解决方案