lind8-1.c

来自「谭浩强第二版的课后习题的答案的源程序」· C语言 代码 · 共 47 行

C
47
字号
#include<stdio.h>
int a,b,m=1,n;

void input()
{
	printf("Please input two numbers.\n");
	scanf("%d%d",&a,&b);
}

void yue()
{
	int x,y;
	if(a<b)
	{
		n=a;
		a=b;
		b=n;
	}
	x=a;
	y=b;
	for(;m!=0;)
	{
		m=x%y;
		x=y;
		y=m;

	}
	m=x;
}

void bei()
{
	n=a*b/m;
}

void output()
{
	printf("\n%d %d\n",m,n);
}

void main()
{
	input();
	yue();
	bei();
	output();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?