问题 1011: C语言程序设计教程(第三版)课后习题6.1

解题思路:
使用牛顿迭代法  解出公约数

之后使用 

两个数之积=公约数*公倍数




注意事项:





参考代码:

#include<stdio.h>

int main()

{

int a,b,t;

scanf("%d%d",&a,&b);

int j;

j=a*b;

while(a%b!=0){

t=b;

b=a%b;

a=t;

}

printf("%d %d",b,j/b);

    return 0;

}


猜你喜欢

转载自blog.csdn.net/acdream_/article/details/80768864