1
2014-04-08 20:07
344 查看
/* Note:Your choice is C IDE */ #include "stdio.h" #define LEN 10 main() { int a[LEN]; int i; int max; int min; int sum; int avg; /* i= 0 1 2 ~ 9 */ /* a[0] a[1] 2 ~ 10 */ /* input*/ printf("please input:"); for( i=0;i<LEN;i++) { scanf("%d",&a[i]); } /*output*/ printf("\n the ordered output is:"); for( i=0;i<LEN;i++) { printf("%d ",a[i]); } printf("\n the reverse ordered output is:"); for( i=0;i<LEN;i++) { /* a[4],a[3] a[2] a[1] a[0] */ /*i 0 1 2 3 4 */ printf("%d ",a[LEN-1-i]); } max = a[0]; for(i = 1;i<LEN;i++){ if(max <a[i]) max = a[i]; } printf("\n the MAX is :%d",max); min=a[0]; for(i = 1;i<LEN;i++) { if(min>a[i]) min=a[i]; } printf("\n the MIN is :%d",min); sum=0; for(i = 1;i<LEN;i++){ sum+=a[i]; } printf("\n the sum is :%d",sum); avg=sum/LEN; printf("\n the avg is :%d",avg); }
相关文章推荐
- 2014年3月份 月会
- Windows Phone-框架结构和启动过程
- android jni中C++与java互相调用小结
- Oracle sqlplus 常用设置
- Oracle实例精解-第一章阅读笔记
- shell——cat,find,xargs,tr,sort,grep
- 调用库函数进行的qsort快速排序
- POJ 1742
- 静态数组表示的有限状态机
- OpenCV中图像旋转(warpAffine)算法的实现过程
- 003
- 一个简洁的Tab
- CPP记录(一)
- 观察者模式-气象台的实现与应用
- 操作系统级别对Hadoop性能优化
- memcpy和memmove的区别与联系
- c
- 【1】 设一个长度为10的整型数组,  0)要求每个元素的值通过scanf输入,输入完成后,  1)请顺序输出这些整数,  2)请倒序输出这些整数,  3)输出这些数中的最大值,最小值
- Android json解析
- 信号量、互斥体和自旋锁