lind6-1.c
来自「谭浩强第二版的课后习题的答案的源程序」· C语言 代码 · 共 22 行
C
22 行
#include<stdio.h>
void main()
{
long a,b,t,i,app,mul; //app presents the max common approximate number of the two numbers
// mul presents the min common multiple number of the two numbers
lin: printf("\nPlease input two numbers.\n");
scanf("%ld%ld",&a,&b);
if(a<b)
{
t=a;
a=b;
b=t;
}
for(i=b;i>0;i--)
{
(a%i==0)&&(b%i==0)? (app=i,i=0):(1);
}
mul=a*b/app;
printf("Their max common approximate number is %ld.\n",app);
printf("Their min common multiple number is %ld.\n",mul);
goto lin; //The max pass number is 46340
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?