用辗转想减法求最大公约数
#include<stdio.h>void main()
{
int divisor(int x,int y);
int a,b;
printf("please input two interger:");
scanf("%d%d",&a,&b);
printf("The higest common divisor =%d\n",divisor(a,b));
printf("The lowest common multiple =%d\n",a*b/(divisor(a,b)));
}
int divisor(int x,int y)
{
int temp;
if(x<y)
{
temp=x;
x=y;
y=temp;
}
do
{
temp=x-y;
x=y;
y=temp;
}while(temp==y);
return y;
} 为何用VC运行输入两个数后没反应?
为何没人答我????
页:
[1]