欢迎来到天天文库
浏览记录
ID:50688187
大小:230.50 KB
页数:41页
时间:2020-03-13
《C语言程序设计作业整理Ⅱ浙大软院C语言.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、7.1.1输入一个正整数n(02、stdio.h>intmain(void){inti,j,n,x;intrepeat,ri;inta[10];scanf("%d",&repeat);for(ri=1;ri<=repeat;ri++){scanf("%d",&n);for(i=0;ia[i])continue;j=n-1;while(j>=i){a[j+1]=a[j];j--;}a[i]=x;brea3、k;}if(i==n)a[n]=x;for(i=0;iintmain(void){inti,n,sum;intrepeat,ri;inta[10];doubleaver4、;scanf("%d",&repeat);for(ri=1;ri<=repeat;ri++){scanf("%d",&n);for(i=0;i5、逆序存放,再按顺序输出数组中的n个元素。输入输出示例:括号内为说明输入2(repeat=2)4(n=4)108125(n=5)12540输出2181004521#includeintmain(void){inti,n,temp;intrepeat,ri;inta[10];scanf("%d",&repeat);for(ri=1;ri<=repeat;ri++){scanf("%d",&n);for(i=0;i6、;i<=(n-1)/2;i++){temp=a[i];a[i]=a[n-1-i];a[n-1-i]=temp;}for(i=0;iintmain(void){inti,index,n7、;intri,repeat;inta[10];scanf("%d",&repeat);for(ri=1;ri<=repeat;ri++){scanf("%d",&n);for(i=0;ia[index])index=i;printf8、("max=%d,index=%d",a[index],index);}return0;}7.1.5输入一个正整数n(1
2、stdio.h>intmain(void){inti,j,n,x;intrepeat,ri;inta[10];scanf("%d",&repeat);for(ri=1;ri<=repeat;ri++){scanf("%d",&n);for(i=0;ia[i])continue;j=n-1;while(j>=i){a[j+1]=a[j];j--;}a[i]=x;brea
3、k;}if(i==n)a[n]=x;for(i=0;iintmain(void){inti,n,sum;intrepeat,ri;inta[10];doubleaver
4、;scanf("%d",&repeat);for(ri=1;ri<=repeat;ri++){scanf("%d",&n);for(i=0;i5、逆序存放,再按顺序输出数组中的n个元素。输入输出示例:括号内为说明输入2(repeat=2)4(n=4)108125(n=5)12540输出2181004521#includeintmain(void){inti,n,temp;intrepeat,ri;inta[10];scanf("%d",&repeat);for(ri=1;ri<=repeat;ri++){scanf("%d",&n);for(i=0;i6、;i<=(n-1)/2;i++){temp=a[i];a[i]=a[n-1-i];a[n-1-i]=temp;}for(i=0;iintmain(void){inti,index,n7、;intri,repeat;inta[10];scanf("%d",&repeat);for(ri=1;ri<=repeat;ri++){scanf("%d",&n);for(i=0;ia[index])index=i;printf8、("max=%d,index=%d",a[index],index);}return0;}7.1.5输入一个正整数n(1
5、逆序存放,再按顺序输出数组中的n个元素。输入输出示例:括号内为说明输入2(repeat=2)4(n=4)108125(n=5)12540输出2181004521#includeintmain(void){inti,n,temp;intrepeat,ri;inta[10];scanf("%d",&repeat);for(ri=1;ri<=repeat;ri++){scanf("%d",&n);for(i=0;i6、;i<=(n-1)/2;i++){temp=a[i];a[i]=a[n-1-i];a[n-1-i]=temp;}for(i=0;iintmain(void){inti,index,n7、;intri,repeat;inta[10];scanf("%d",&repeat);for(ri=1;ri<=repeat;ri++){scanf("%d",&n);for(i=0;ia[index])index=i;printf8、("max=%d,index=%d",a[index],index);}return0;}7.1.5输入一个正整数n(1
6、;i<=(n-1)/2;i++){temp=a[i];a[i]=a[n-1-i];a[n-1-i]=temp;}for(i=0;iintmain(void){inti,index,n
7、;intri,repeat;inta[10];scanf("%d",&repeat);for(ri=1;ri<=repeat;ri++){scanf("%d",&n);for(i=0;ia[index])index=i;printf
8、("max=%d,index=%d",a[index],index);}return0;}7.1.5输入一个正整数n(1
此文档下载收益归作者所有