• 第一次看全英文的题,还是有点不舒服的感觉,还是用了翻译器

    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.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财务管理的更多相关文章

  1. Java数组练习题小结

    //2015/07/07 //Java数组小小练习题 /* 3. 写一个函数,计算一个整数数组的平均值 4. 自定义一个整数数组a,读入一个整数n,如果n 在数组中存在,则输出n 的下标:如果不存在, ...

  2. Java循环和数组练习题:打印素数升级版

    前两天一个小伙伴问了我一个数组的练习题,我一看思路很清晰,就是打印素数加了个数组.没想到写的时候啪啪打脸,终究还是没逃过眼高手低.本来不打算发出来了,因为发出来愈发显得我很菜,最后还是打算分享出来,一 ...

  3. Java学习笔记6(循环和数组练习题)

    1.输出100到1000的水仙花数: public class LoopTest{ public static void main(String[] args){ int bai = 0; int s ...

  4. 【图文+视频新手也友好】Java一维数组详细讲解(内含练习题答案+详解彩蛋喔~)

    目录 视频讲解: 一.数组的概述 二.一维数组的使用 三.Arrays工具类中的sort方法(sort方法用的多,我们具体讲一下) 四.数组中的常见异常 五.一维数组练习题 六.彩蛋(本期视频使用的P ...

  5. NSArray数组的学习总结

    1.不可变数组NSArray NSArray是不可变的,而且只能储存Object-c对象.另外,数组的最后一个元素一定是nil,表示结束. 注:这些集合类只能收集cocoa对象(NSOjbect对象) ...

  6. awk巩固练习题

    第1章 awk数组练习题 1.1 文件内容(仅第一行) [root@znix test]# head -1 secure-20161219 access.log ==> secure-20161 ...

  7. Ping pong(树状数组求序列中比某个位置上的数小的数字个数)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2492 Ping pong Time Limit: 2000/1000 MS (Java/Others) ...

  8. day04_数组

    数组 学习目标: 1. jvm内存图入门 2. 一维数组的使用 3. 二维数组的使用 4. 数组的内存结构 5. 数组中常见算法 6. 数组中常见的异常 一.JVM内存图入门 java程序运行在jvm ...

  9. awk高级进阶

    第1章 awk数组练习题 1.1 文件内容(仅第一行) [root@znix test]# head -1 secure-20161219 access.log ==> secure-20161 ...

随机推荐

  1. ppp 完全理解(二)【转】

    转自:https://blog.csdn.net/tianruxishui/article/details/44057717 ppp 完全理解(二) pppd 协议及代码分析 作者:李圳均 日期:20 ...

  2. Keepalived详解(三):Keepalived基础功能应用实例【转】

    Keepalived基础功能应用实例: 1.Keepalived基础HA功能演示: 在默认情况下,Keepalived可以实现对系统死机.网络异常及Keepalived本身进行监控,也就是说当系统出现 ...

  3. js学习笔记--基础部分

    自增 自增 ++ 通过自增可以使变量在自身的基础上增加1 对于一个变量自增以后,原变量的值会立即自增1 无论使a++, 还是++a,都会立即使原变量的值自增1. 不同的是a++ 和++a的值不同. a ...

  4. proxyTable设置代理解决跨域问题

    应用场景:在不同域之间访问是比较常见,在本地调试访问远程服务器....这时就有域问题. 解决方案一:在config里面的index.js里面的proxyTable //这里理解成用‘/api'代替ta ...

  5. centos6.8上PHP5.3升级到PHP5.4及更高版本方法

    执行命令下载.安装yum源,当前是针对Centos6并且64位版本的源: [root@T_249 yum.repos.d]# rpm -ivh http://dl.fedoraproject.org/ ...

  6. (转!)Pyinstaller 打包发布经验总结

    原文地址 https://blog.csdn.net/weixin_42052836/article/details/82315118 具体的实现图待本人实现后贴上 原 Pyinstaller 打包发 ...

  7. Statically Linking freeglut

    It’s possible statically link freeglut into your applications, instead of dynamically linking agains ...

  8. ubuntu Qt linuxdeployqt打包

    1.下载PatchELF 0.9.,https://nixos.org/patchelf.html 安装:./configure make sudo make install 2.终端命令设置设置环境 ...

  9. (常用)configparser,hashlib,hamc模块

    configparser模块 #专门解析my.ini这种形式的文件(cnf) import configparser  config=configparser.ConfigParser()  conf ...

  10. Select查询命令

    一开始SELECT查询的命令为     SELECT * FROM employee;     SELECT 要查询的列名 FROM 表名字 WHERE 限制条件;     若要查询所有内容,就用*代 ...