考研c语言设计题
# include & ltstdio.h & gt
# include & ltstdlib.h & gt
# include & lttime.h & gt
int main(){
int i,a[50],b[50],sum=0,count = 0;
浮动平均值;
Printf("随机生成50个两位正整数:\ n ");
srand((无符号)时间(空));
for(I = 0;我& lt50;i++){
a[I]= rand()% 90+10;
sum = sum+a[I];
if((i+1)%10==0)
printf("%d\n ",a[I]);
其他
printf("%d ",a[I]);
}
平均值=(浮点)总和/50;
Printf("高于平均值元素:\ n ");
for(I = 0;我& lt50;i++){
if(a[I]& gt;平均){
count++;
if(count%10==0)
printf("%d\n ",a[I]);
其他
printf("%d ",a[I]);
}
}
printf(" \ n数字为5的元素:\ n ");
count = 0;
for(I = 0;我& lt50;i++){
if(a[I]/10 = = 5 | | a[I]% 10 = = 5){
b[计数]= a[I];
count++;
}
}
for(I = 0;我& lt数数;i++){
if(b[i]%10==0)
printf("%d\n ",b[I]);
其他
printf("%d ",b[I]);
}
返回0;
}