高手们,帮我编几个c语言的小程序!!谢谢.明天就要交!!
高手们,帮我编几个c语言的小程序!!谢谢.明天就要交!!
日期:2007-11-07 17:42:45 人气:1
3. 编一C程序,它能读入两个整数m与n,计算并输出m与n的绝对值的最大公约数及最小公倍数
解:源程序如下:
int gys (int x,int y)
{
int j;
j=(x<y)?x:y;
for(;j>0;j--)
if(x%j==0&&y%j==0)
break;
else
continue;
return (j);
}
int gbs (int z,int w)
{
int i;
i=(z>w)?z:w;
f