数组练习题A财务管理
第一次看全英文的题,还是有点不舒服的感觉,还是用了翻译器
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 outputSample 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
代码样例:
#include<stdio.h>
#define N 12
int main()
{
double m=0,l;
double s[N];
int i;
for(i=0;i<N;i++)
{scanf("%lf\n",&s[i]);
m=m+s[i];}
l=m/N;
printf("$");
printf("%.2lf",l);
return 0;
}
- 定义一个可以存放十二个数值的数组,循环累加,计算平均
数组练习题A财务管理的更多相关文章
- Java数组练习题小结
//2015/07/07 //Java数组小小练习题 /* 3. 写一个函数,计算一个整数数组的平均值 4. 自定义一个整数数组a,读入一个整数n,如果n 在数组中存在,则输出n 的下标:如果不存在, ...
- Java循环和数组练习题:打印素数升级版
前两天一个小伙伴问了我一个数组的练习题,我一看思路很清晰,就是打印素数加了个数组.没想到写的时候啪啪打脸,终究还是没逃过眼高手低.本来不打算发出来了,因为发出来愈发显得我很菜,最后还是打算分享出来,一 ...
- Java学习笔记6(循环和数组练习题)
1.输出100到1000的水仙花数: public class LoopTest{ public static void main(String[] args){ int bai = 0; int s ...
- 【图文+视频新手也友好】Java一维数组详细讲解(内含练习题答案+详解彩蛋喔~)
目录 视频讲解: 一.数组的概述 二.一维数组的使用 三.Arrays工具类中的sort方法(sort方法用的多,我们具体讲一下) 四.数组中的常见异常 五.一维数组练习题 六.彩蛋(本期视频使用的P ...
- NSArray数组的学习总结
1.不可变数组NSArray NSArray是不可变的,而且只能储存Object-c对象.另外,数组的最后一个元素一定是nil,表示结束. 注:这些集合类只能收集cocoa对象(NSOjbect对象) ...
- awk巩固练习题
第1章 awk数组练习题 1.1 文件内容(仅第一行) [root@znix test]# head -1 secure-20161219 access.log ==> secure-20161 ...
- Ping pong(树状数组求序列中比某个位置上的数小的数字个数)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2492 Ping pong Time Limit: 2000/1000 MS (Java/Others) ...
- day04_数组
数组 学习目标: 1. jvm内存图入门 2. 一维数组的使用 3. 二维数组的使用 4. 数组的内存结构 5. 数组中常见算法 6. 数组中常见的异常 一.JVM内存图入门 java程序运行在jvm ...
- awk高级进阶
第1章 awk数组练习题 1.1 文件内容(仅第一行) [root@znix test]# head -1 secure-20161219 access.log ==> secure-20161 ...
随机推荐
- BIM平台 http://gzcd.bim001.cn
BIM平台: http://gzcd.bim001.cn
- bootstrap例子
<!DOCTYPE html> <html> <head> <title>Bootstrap 101 Template</title> &l ...
- C++著名程序库的比较和学习经验
内容目录:1.C++各大有名库的介绍——C++标准库2.C++各大有名库的介绍——准标准库Boost3.C++各大有名库的介绍——GUI4.C++各大有名库的介绍——网络通信5.C++各大有名库的介绍 ...
- Windows系统下安装dig命令
dig 是一个 Linux 下用来 DNS 查询信息的工具,全称是Domain Information Groper,与 nslookup 类似,但比 nslookup 功能更强大.Windows 下 ...
- vue 之 引入elementUI(两步走)
1.npm 引入elementUI npm i element-ui -S 2.在main.js文件中全局引入 import ElementUI from 'element-ui' import 'e ...
- iPhone内存溢出——黑白苹果
一旦iPhone内存长期占用过大,一关机即再难启动,如果你Home键加power键等都不行,那么可以要刷机了. 方式: 1.电脑下载ITunes,这个过程比较漫长,一系列逐渐大概3G,下载完成打开. ...
- Oracle 数据备份与恢复
前言 一:备份与恢复概述 二:RMAN 工具概述 1: RMAN 组件 1: RMAN命令执行器 [oracle@localhost ~]$ rman target system/nocatalog ...
- Confluence 6 从其他备份中恢复数据
一般来说,Confluence 数据库可以从 Administration Console 或者 Confluence Setup Wizard 中进行恢复. 如果你在恢复压缩的 XML 备份的时候遇 ...
- Confluence 6 CSS 指南:修改顶部背景
Confluence 默认页面的顶部是有关站点的菜单连接,在这里定义了 快速连接, 浏览菜单,用户菜单和快速查找输入框.在这个示例中,我们将会尝试修改顶部的菜单部分的背景和一些自定义的图片. 创建一个 ...
- Swift DispatchQueue
延迟2s执行 DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()+2)