1004题解题报告

2026/4/24 3:52:00

解题报告

题号:1004

题目:Larry graduated this year and finally has a job. He's making a lot of money,

but somehow never seems to have enough. Larry has decided that he needs to grab hold of his financial portfolio and solve his financing problems. The first step is to figure out what's been going on with his money. Larry has his bank account statements and wants to see how much money he has. Help Larry by writing a

program to take his closing balance from each of the past twelve months and calculate his average account balance. Input

The input will be twelve lines. Each line will contain the closing balance of his bank account for a particular month. Each number will be positive and displayed to the penny. No dollar sign will be included. Output

The output will be a single number, the average (mean) of the closing balances for the twelve months. It will be rounded to the nearest penny, preceded immediately by a dollar sign, and followed by the end-of-line. There will be no other spaces or characters in the output. Sample Input 100.00 489.12 12454.12 1234.10 823.05 109.20 5.27 1542.25 839.18 83.99 1295.01 1.75

Sample Output $1581.42

翻译:

帮助拉里写一个程序由过去十二个月,每月他的期末余额,计算其平均帐户余额。 输入

十二行。每一行都将包含一个特定的月份,他的银行账户的期末余额。每个数字都将是正的,显示精确到分钱。没有美元符号 输出

输出将是一个单独的数字,为十二个月的平均余额。这将是四舍五入到最接近的货币,数字前面有一个美元符号。

思路:定义一个十二位数组a,输入十二个月份的月末余额存入a,将它们相加,

后除以12,输出结果(平均余额)

代码:

#include main() {

float a[12],ave=0; int i;

for(i=0;i<12;i++) {

scanf(\ave+=a[i]/12; }

printf(\}


1004题解题报告.doc 将本文的Word文档下载到电脑
搜索更多关于: 1004题解题报告 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219