P026


私信TA

用户名:uq_90166325580

访问量:325

签 名:

H2030821026

等  级
排  名 2522
经  验 2203
参赛次数 4
文章发表 7
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

TA的其他文章

解题思路:

注意事项:

参考代码:

#include

int main()    

{


int a,b,i,temp;

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

 if(a<b){

     temp=a;

 }

else

temp=b;   //判断循环 

   for(i=2;i<temp;i++){                                

        if(a%i==0&&b%i==0)

              c=i;

    }

printf("%d ",c);                                                    //最大公约数

printf("%d\n",c*(a/c)*(b/c));                               //最小公倍数


//printf("%d",(a*b)/c);                                //假设x和y的最大公约数是m,最小公倍数是n,则xy=mn

return 0;


 

0.0分

0 人评分

  评论区