C语言问题求教
Ifallvariableshavebeendefinedanddeclaredinthefollowingprogram,allthevariableswhichcan...
If all variables have been defined and declared in the following program, all the variables which can be used in function fun() are __. (2分)void fun(int x){ static int y; …… return;}int z;void main( ){ int a,b; fun(a); ……}A.x,yB.x,y,zC.a,b,y,zD.a,b,x,y,z
展开
展开全部
1
int integerpower(int base,int exponent){
int i;
int ret;
if(exponent<0)return -1;
for(ret=base,i=1;i!=exponent;++i){
ret*=base;
}
return ret;
}
2
int integerpower(int base,int exponent){
if(exponent<0)return -1;
if(exponent==0)return 1;
if(exponent==1)return base;
else return base*integerpower(base,exponent-1);
}
int integerpower(int base,int exponent){
int i;
int ret;
if(exponent<0)return -1;
for(ret=base,i=1;i!=exponent;++i){
ret*=base;
}
return ret;
}
2
int integerpower(int base,int exponent){
if(exponent<0)return -1;
if(exponent==0)return 1;
if(exponent==1)return base;
else return base*integerpower(base,exponent-1);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include <stdio.h>
int high_ave(int a[],int n)
{
int i,sum=0,k=0;
float ave;
for(i=0;i<n;i++) sum+=a[i];
ave=1.0*sum/n;
for(i=0;i<n;i++)
{
if(a[i]>ave) k++;
}
return k;
}
void main()
{
int i;
int f[100];
printf("input the score of the students\n");
for(i=0;i<30;i++) scanf("%d",&f[i]);
printf("%d\n",high_ave(f,30));
}
int high_ave(int a[],int n)
{
int i,sum=0,k=0;
float ave;
for(i=0;i<n;i++) sum+=a[i];
ave=1.0*sum/n;
for(i=0;i<n;i++)
{
if(a[i]>ave) k++;
}
return k;
}
void main()
{
int i;
int f[100];
printf("input the score of the students\n");
for(i=0;i<30;i++) scanf("%d",&f[i]);
printf("%d\n",high_ave(f,30));
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询