在for循环中使用数组
来源:互联网 发布:淘宝美工岗位职责 编辑:程序博客网 时间:2024/05/22 10:39
#include <stdio.h>
#define SIZE 10
#define PAR 72
int main (void)
{
int index,score[SIZE];
int sum = 0;
float average;
printf ("Enter %d golf scores: \n",SIZE);
for (index = 0; index < SIZE; index++)
scanf ("%d",&score[index]); //读入10个分数
printf ("The scores read in are as follows: \n");
for (index = 0; index < SIZE; index++)
printf ("%5d",score[index]); //验证输入
printf ("\n");
for (index = 0; index < SIZE; index++)
sum += score[index]; //求它们的和
average = (float) sum/SIZE; //节省时间的方法
prinft ("Sum of scores = %d, average = %.2f\n",sum,average);
printf ("That's a handicap of %.0f.\n",average - PAR);
return 0;
}
- 在for循环中使用数组
- Java中增强for循环在一维数组和二维数组中的使用
- 在jsp中使用for循环
- 如何在for循环中使用多线程
- flex在for循环中使用setTimeout
- 怎么在oracle中使用for循环
- 运用for循环在数组中进行 一些变换
- C语言中如何在不使用数组的情况下求方差?使用数组和使用for循环的区别。
- 关于在DELPHI中FOR循环语句的使用问题
- 在shell脚本中,如何写使用for循环
- 在shell脚本中,如何写使用for循环
- C#中Random()在for循环内使用的困惑
- 如何在游标for循环中使用动态SQL语句?
- Java中几种输出数组的for循环,以及循环中使用标签(非goto)
- 数组迭代要优先使用for循环而不是for...in循环
- js中使用for 循环和 for in 遍历数组区别
- oracle中使用for循环
- shell中for循环使用
- 【Android LibGDX游戏引擎开发教程】第01期:LibGDX的详细介绍
- ASP.NET MVC4自定义分页
- Exchange 2007 中的电子邮件地址策略和接受域
- [HDU 4252] A Famous City[单调队列]
- 2013 - ECJTU 暑期训练赛第七场-problem-G
- 在for循环中使用数组
- hdu 1394 Minimum Inversion Number
- hdu 4474 数位搜索
- UVA 11044 (13.08.07)
- 门面设计模式
- Halloween treats
- PMP项目管理知识体系——第六章 项目时间管理
- C++中Cstring使用小结
- [脚本] 转载一个抛物线的代码