poj 1004 Financial Management

本文介绍了一个简单的程序,用于帮助刚毕业且面临财务管理难题的人计算过去十二个月银行账户的平均余额。该程序通过读取每个月的账户余额,计算并输出平均余额。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Financial Management

Time Limit: 1000MS

Memory Limit: 10000K

Total Submissions: 97874

Accepted: 47335

Description

Larrygraduated this year and finally has a job. He's making a lot of money, butsomehow never seems to have enough. Larry has decided that he needs to grabhold of his financial portfolio and solve his financing problems. The firststep is to figure out what's been going on with his money. Larry has his bankaccount statements and wants to see how much money he has. Help Larry bywriting a program to take his closing balance from each of the past twelvemonths and calculate his average account balance.

Input

The inputwill be twelve lines. Each line will contain the closing balance of his bankaccount for a particular month. Each number will be positive and displayed tothe penny. No dollar sign will be included.

Output

The outputwill be a single number, the average (mean) of the closing balances for thetwelve months. It will be rounded to the nearest penny, preceded immediately bya dollar sign, and followed by the end-of-line. There will be no other spacesor 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

Source

Financial Management

Time Limit: 1000MS

Memory Limit: 10000K

Total Submissions: 97874

Accepted: 47335

Description

今年毕业并找到了一个工作。他已经能够挣很多钱,但是总感觉不够用。Larry已经决定抓住他的金融市场的投资来解决经济危机。第一步是计算出他的钱哪里去了。Larry有一个他的银行账目表可以查看他有多少钱。写一个程序帮助Larry计算过去12年里的平均账目。

Input

输入包括12行。每一行包括一个月的银行账单月终余额。每一个数字都是正的以便士为单位。没有美元的符号。

Output

输出一个数字,12月的平均值。四舍五入后并加上一个美元的符号,最后一行没有多余的空格和字符。

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

Source

//很水的题哟,不过很神奇的是= w=,如果用double就会w。。。。。。ono

#include<stdio.h>
#include<string.h>
#include<math.h>
 
void input(void);
 
int main(void){
   freopen("in.txt","r", stdin);
   input();
   return 0;
}
 
void input(void){
   float f, s=0;
   int i;
   for (i = 0;i < 12;i ++){
       scanf("%f", &f);
       s+=f;
    }
   printf("$%.2f", s/12);
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值