杭电acm--1064
来源:互联网 发布:js yui在线压缩 编辑:程序博客网 时间:2024/06/16 09:47
Problem Description
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.
#include<stdio.h>#include<stdlib.h>#include<iostream>#include<cmath>#include<iomanip>//#define P 3.141592653using namespace std;void main(){double avg, sum=0.0, arr[12];for (int i = 0; i < 12; i++){cin >> arr[i];sum += arr[i];}avg = sum / 12;cout <<'$'<< fixed<<setprecision(2) << avg<<endl;system("pause");}
0 0
- 杭电acm--1064
- 杭电ACM 1064 Financial Management
- 杭电ACM 1064: Financial Management
- 杭电ACM 1003
- 杭电 ACM 2016
- 杭电acm 1010
- 杭电 acm 1045
- 杭电ACM-1010
- 杭电ACM 1172
- 杭电ACM 1174
- 杭电ACM 1175
- 杭电ACM 分类
- 杭电ACM分类
- 杭电acm 1000
- 杭电acm 1001
- 杭电acm 1002
- 杭电acm分类
- 杭电acm分类
- hdoj 2825 Wireless Password 【AC自动机 + 状压dp】
- 我读过的最好的epoll讲解
- bin/ld.exe: error: cannot find -landroid等问题
- 选择排序——堆排序
- 文章标题
- 杭电acm--1064
- Item 39:明智地使用private继承 Effective C++笔记
- parseInt中的转换细节
- 黑马程序员——网络编程
- Java中弹出对话框中的几种方式
- 文章标题
- HDU2025 查找最大元素
- Coursera_Stanford_ML_ex4_神经网络训练 作业记录
- html元素与间距