int i,n,a1[N],a2[N]; printf("请输入数组1的元素个数:"); scanf("%d",&n); printf("请输入%d个数组元素",n); for(i=0;i<n;i++) scanf("%d",&a1[i]); printf("数组1的平均值为%.4f.\n",avg(a1,n)); printf("请输入数组2的元素个数:"); scanf("%d",&n); printf("请输入%...
int N;int max3(int a[],int m[]){int i,j,k,t,b[N];for(i=0;i<N;i++)b[i]=a[i];for(i=0;i<3;i++){k=i;for(j=i+1;j<N;j++)if(b[j]>b[k])k=j;t=b[i];b[i]=b[k];b[k]=t;m[i]=b[i];} } int main(){ scanf("%d",&N);int a[N],m...
int search(int list[],int n,int x){ int i,index=-1;for(i=0;i<n;i++)if(list[i]==...
int search(int list[],int n,int x){ int i,index=-1;for(i=0;i<n;i++)if(list[i]==x){//注意是== index=i;//既然都明白下标从0开始,有必要+1吗?break;} return index;//不返回值行吗?}
int i,sum=0;for(i=0;i<10;i++){ sum=sum+a[i];} return (sum/10);} int max(float *a){ int i,max=0,x;for(i=0;i<10;i++){ if(max<a[i])max=a[i];x=i+1;} return x;} void main(){ int i,max_biao;float a[10],av;printf("please input numbers:");f...
main( ){ int nums[10]={100,200,300,400,500,600,700,800,900,1000},i,sum=0; char nums2str[10][5]={"100","200","300","400","500","600","700","800","900","1000"},str[41]; printf("数字型和字符串型的两个数组元素分别为:\n"); printf(...
C语言编程>第二十二周 ⑧ 请补充fun函数,该函数的功能是:求100(不包括100)以内能被2或3整除,但不能同时被2和3整除的自然数。结果保存在数组a中,fun函数返回数组a元素的个数。 越努力越幸运! 加油,奥力给!!!...
include<stdio.h>int FF(int a[],int n){if(n==1)return a[0]; return a[n-1]*FF(a,n-1);}int main(){int n=5,a[5]={1,2,3,4,5}; printf("%d\n",FF(a,5)); return 0; }
{ int a[10],i,j,evencount=0,mean=0,sum=0;for(i=0;i<10;i++){ printf("please input number %d \n",i);scanf("%d",&a[i]);if(a[i]%2==0)evencount++;sum+=a[i];} mean=sum/10;printf("The even number is : %d the average is :%d ",evencount,mean);} ...
include<stdio.h> float MulArray(float a[],int n){ float sum=1;for(int i=0;i<n;i++)sum*=a[i];printf("%f",sum);} main(){ float a[111];int n;scanf("%d",&n);for(int i=0;i<n;i++)scanf("%f",&a[i]);MulArray(a,n);} ...