cheng1107


私信TA

用户名:chengrui1990

访问量:4896

签 名:

学习走起

等  级
排  名 15979
经  验 774
参赛次数 0
文章发表 9
年  龄 27
在职情况 在职
学  校 理工大学
专  业

  自我简介:

解题思路:





注意事项:





参考代码:

#include <stdio.h>


int main(void)

{

  int a,b,j;

  int common = 1;

  int i = 1;


  while((scanf("%d%d",&a,&b) != 2)||(a == 0)||(b == 0))

  {

    printf("the type of input is wrong\n");  

    printf("please input again!\n");

  }


  while((i <= a)&&(i <= b))

  {

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

    {

      common = i;

    }

    i++;    

  }

  j=a*b/common;

  printf("%d %d\n",common,j);

  

  return 0;

}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区