数组练习题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 ...
随机推荐
- linux 安装图行界面
centos6的环境中 代码:[root@ebs122 sysconfig]#yum groupinstall "Desktop" 使用 init 5命令进入图形化界面,如果成功的 ...
- 多次使用图片物理路径提示占用进程,用流读取设置FileShare权限解决
//用流读取图片 清空之后再次关联地址 //设置FileShare.ReadWrite权限之后 不会提示占用进程异常 item是物理路径DiscussionImageList = new Interv ...
- 关于Oracle数据库故障诊断基础架构
本节包含有关Oracle数据库故障诊断基础结构的背景信息.它包含以下主题: 故障诊断基础架构概述 关于事件和问题 故障诊断基础设施组件 自动诊断信息库的结构,内容和位置 故障诊断基础架构概述 故障诊断 ...
- SpringSecurity实现短信登录功能
⒈封装短信验证码类 package cn.coreqi.security.validate; import java.time.LocalDateTime; public class Validate ...
- 【转】PEP8 规范
[转]PEP8 规范 Python PEP8 编码规范中文版 原文链接:http://legacy.python.org/dev/peps/pep-0008/ item detail PEP 8 ...
- SharePoint 2010 安装错误:请重新启动计算机,然后运行安装程序以继续
一.环境:Windows Server 2008 R2 with sp1,SharePoint 2010 二.问题描述: 正常的安装SharePoint 2010 ,安装完必备组件,并提示所有必备组件 ...
- tomcat apr 部署
背景 这还是为了高并发的事,网上说的天花乱坠的,加了apr怎么怎么好,我加了,扯淡.就是吹牛用.我还是认为,性能问题要考设计逻辑和代码解决,这些都是锦上添花的. 步骤 1 windows 部署简单,虽 ...
- $Django 站点:样式--文章--分类文章--文章详情--文章评论点赞--文章评论点赞统计(数据库优化)
<h3>个人站点下的</h3> 知识点 url (r'(?P<username>\w+)/p/(?P<id>\d+)', xiangxi,name='x ...
- LabVIEW将字符串转化为十进制
(1)作用:将ASCII当做成十六进制来表示,并计算这个十六进制数对应的十进制大小 例如:008A本身对应的ASCII码用十六进制表示为为30 30 38 41,但有些协议中将008A当成0x008A ...
- [转载]RabbitMQ消息可靠性分析
有很多人问过我这么一类问题:RabbitMQ如何确保消息可靠?很多时候,笔者的回答都是:说来话长的事情何来长话短说.的确,要确保消息可靠不只是单单几句就能够叙述明白的,包括Kafka也是如此.可靠并不 ...