原创 Linux 返回语句

2024-6-2 20:21 239 3 3 分类: 软件与OS 文集: Linux
代码:

/*
 * ccb.c
 *
 *  Created on: Jun 2, 2024
 *      Author: root
 */


#include
void common_multiple(a,b,c)
int a,b,c;
{
	if(a>0 && b>0 && c>0)
	{
		if(a%(b*c)==0)
		{
			printf("Least common mutiple is %d",a);
			return;
		}
		if(b%(a*c)==0)
		{
			printf("Least common mutiple is %d",b);

			return;
		}
		if(c%(a*b)==0)
		{
			printf("Least common mutiple is %d",c);
			return;
		}
		int i;
		for(i=a*b;i<=a*b*c;i+=a*b)
		{
			if(i%c==0)
			{
				printf("Least common mutiple is %d",i);
				return;
			}
		}
	}
	else
		puts("no least common mutiple");
}
int main()
{
	int a=1,b=2,c=3;
	puts("please input three positive integer: ");
	scanf("%u,%u,%u",&a,&b,&c);
	common_multiple(a,b,c);
	return 0;

}
运行

文章评论0条评论)

登录后参与讨论
我要评论
0
3
关闭 站长推荐上一条 /2 下一条