在考生文件夹下,给定程序FILL.C的功能是:
求两个正整数x,y的最大公约数和最小公倍数。
例如:如果x=24,y=36,程序的输出应为:
max is : 12
min is : 72 。
#include
#include
#include
void main()
{ int x,y,t,max,min,i,n1,n2;
printf("Please enter two numbers:");
scanf("%d,%d",&x,&y);
if(x > y)
{t = x; x = y; y = t;}
n1=x; n2=y;
t = n2 % n1;
/************found************/
while(t!=0) |
{
n2 = n1 ;
n1 = t ;
t = n2 % n1;
}
/************found************/
max=n1; |
min = x * y / max ;
printf("max is : %d\n",max);
printf("min is : %d\n",min);
}
2018年全国计算机等级考试调整方案
[考试动态]2017年11月20日全国计算机等级考试计算机基础及Photoshop应用试题答案汇总(6套)
[Photoshop应用]2017年2月3日全国计算机等级考试四级数据库系统工程师试题及答案汇总(22套)
[数据库工程师]2017年2月2日全国计算机一级考试模拟试题及答案300题
[WPS Office应用]2017年1月22日2017年3月全国计算机等级考试报名时间及报名入口汇总
[考试动态]2017年1月3日