博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
数组A - 财务管理
阅读量:6974 次
发布时间:2019-06-27

本文共 1392 字,大约阅读时间需要 4 分钟。

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.00489.1212454.121234.10823.05109.205.271542.25839.1883.991295.011.75

Sample Output

$1581.42 代码:
#include
int main (){ int i; double n[12], sum = 0; for(i = 0;i <= 11;i++) { scanf("%lf", &n[i]); sum += n[i]; } sum /= 12; printf("$%.2f", sum); return 0; }

  一道很简单的题目,今天因为回家,在路上耽误了很多时间就只写了这一题,明天再肝!

转载于:https://www.cnblogs.com/zw431387/p/10235246.html

你可能感兴趣的文章
21.调用stop()方法停止当前所有动画效果
查看>>
匿名方法
查看>>
解析Java对象的equals()和hashCode()的使用
查看>>
关于JDK1.8 HashMap扩容部分源码分析
查看>>
Git使用手册【转】
查看>>
JSOUP如何POST只含JSON格式的数据
查看>>
LeetCode OJ:Generate Parentheses(括号生成)
查看>>
sql 各种格式
查看>>
学习javascript过程中的心得体会
查看>>
分布式文件系统之FastDFS
查看>>
Basic Tutorials of Redis(7) -Publish and Subscribe
查看>>
谈谈Circuit Breaker在.NET Core中的简单应用
查看>>
PyCharm IDE环境搭建
查看>>
HADOOP之PiG简介
查看>>
2017 多校6 String
查看>>
influxdb与传统数据库的比较
查看>>
滚动字幕
查看>>
Centos目录结构详细版
查看>>
MySQL 如何执行关联查询
查看>>
从硬币游戏学习敏捷开发
查看>>