描述
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.
输入
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.
输出
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.
样例输入
100.00
489.12
12454.12
1234.10
823.05
109.20
5.27
1542.25
839.18
83.99
1295.01
1.75
样例输出
1581.42
 1 #include<stdio.h>
2 int main(int argc, char const *argv[]) {//char *argv[]是一个字符数组,其大小是int argc,主要用于命令行参数argv[]
3 double sum = 0, a;
4 int n = 12;
5 while(n--) {
6 scanf("%lf", &a);//%lf双精度浮点型数据(也就是double)的输入格式控制符
7 sum += a;
8 }
9 printf("%.2lf\n", sum/12);
10 return 0;
11 }

最新文章

  1. Excel怎样从一串字符中的某个指定“字符”前后截取字符及截取字符串常用函数
  2. bwa用法
  3. 洛谷 P1014 Cantor表 Label:续命模拟QAQ
  4. Xcode模拟器和真机生成的日志查看(转载)
  5. Windows10系统如何安装Microsoft Visual Studio 2015及最小子数组和求解
  6. C# 获取文件名及扩展名
  7. 字母A-Z写法
  8. setTimeout的若干坑
  9. 丢掉Mask遮罩,更好的圆形Image组件[Unity]
  10. [刷题]算法竞赛入门经典(第2版) 5-10/UVa1597 - Searching the Web
  11. Spring context:property-placeholder 一些坑
  12. vector作为函数返回值
  13. Divide Candies CodeForces - 1056B (数学)
  14. Shell脚本中的break continue exit return
  15. css 背景(background)属性、背景图定位
  16. Centos6.5---samba文件共享服务配置(一)
  17. jar 包启动
  18. python大法好——面向对象
  19. Git提交新项目
  20. 一些常用SQL语句大全

热门文章

  1. 实时渲染基础(4)纹理(Texture)
  2. .Net Core 实现 自定义Http的Range输出实现断点续传或者分段下载
  3. [源码解析] PyTorch 流水线并行实现 (6)--并行计算
  4. 低代码BPM平台
  5. 【UE4】GAMES101 图形学作业4:贝塞尔曲线
  6. rocketmq优雅停机往事
  7. AtCoder Beginner Contest 224
  8. BUAA 2020 软件工程 热身作业
  9. zuul过滤器filter 的编写
  10. 常用Java API:Calendar日期类