在线等答案好心人帮忙! 1.c语言变量的存储类型__ __ __ __. 2.从键盘任意输入两个整数a,b,求...

在线等答案好心人帮忙!
1.c语言变量的存储类型__ __ __ __.
2.从键盘任意输入两个整数a,b,求其最大公因子,并输出显示。要求:采用函数调用的方式来实现。

在线等答案!四点之前!一定给分!

1: auto, register, static, extern或者回答中文:自动,寄存器,静态,外部
2:用辗转相除法,参数是a,b,返回值是公因子
你用的是手机提问,有字数限制,没办法贴出来第2题的代码,只能给你说上面的思路
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-12-30
1.自动,寄存器,静态,外部
2.
#include <stdio.h>
int f(int a,int b)
{ while(b)
{
int t=a%b;
a=b;b=t;
}
return a;
}
void main()
{
int a,b;
scanf("%d%d",&a,&b);
printf("%d\n",f(a,b));
}
第2个回答  2011-12-30
1,c语言变量的存储类型可分为:永久性和临时性两种。

永久性变量的关键字是:extern和static两个,临时性的为:auto和register
第3个回答  2012-01-01
int a,b;
int i;
scanf("%d%d",&a,&b);
for(i=b;b>=1;i--)
{
if(a%i==0&&b%i==0)
printf("最大公因子为:%d",i);
}
记住在输入的时候a>b。
第4个回答  2011-12-30
1、auto , static, extern, register
第5个回答  2011-12-31
#inlcude<iostream.h>
int max(int a,int b)
{int m=a;int n=b;
int r=a%b;
while(r!=0)
{m=n;n=r;
r=m%n;}
return n;
}
int main()
{int c,d;
c=4,d=6;
cout<<max(c,d)<<endl;
return 0;
}
相似回答