I - u Calculate e
Description
where n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.
Output
Sample Output
#include<iostream>
#include<iomanip>
using namespace std;
double f(int n)
{
long double a=;
for(int i=;i<=n;i++)a*=i;
return a;
}
int main()
{
cout << "n e"<<endl<<"- -----------"<<endl;
double e=;
cout<<<<" "<<e<<endl;
for(int i=;i<=;++i)
{
e+=/f(i);
cout<<i<<" ";
if(i!=) cout<<setprecision()<<e<<endl;
else cout<<setprecision()<<e<<<<endl;
}
//system("pause");
return ;
}
不难!!不要忘了long double !!!!
I - u Calculate e的更多相关文章
- [转] PHP计算两个坐标之间的距离, Calculate the Distance Between Two Points in PHP
Calculate the Distance Between Two Points in PHP There are a lot of applications where it is useful ...
- CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin ...
- maven -- 问题解决(二)解决“Could not calculate build plan”问题
错误提示如下:(eclipse+maven) Could not calculate build plan: Failure to transfer org.apache.maven.plugins: ...
- 线段树 + 矩阵 --- ZOJ 3772 Calculate the Function
Calculate the Function Problem's Link: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCod ...
- hdu 1012:u Calculate e(数学题,水题)
u Calculate e Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- Calculate its MTBF assuming 2000 FITS for each DRAM
COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION A common unit of meas ...
- u Calculate e 分类: HDU 2015-06-19 22:18 14人阅读 评论(0) 收藏
u Calculate e Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- How to calculate a good InnoDB log file size
Peter wrote a post a while ago about choosing a good InnoDB log file size. Not to pick on Peter, b ...
- Calculate the formula
Problem Description You just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2. Input ...
- How to Calculate difference between two dates in C# z
Do you need to find the difference in number of days, hours or even minute between the two date rang ...
随机推荐
- QT5-控件-QDateEdit 和 日期类QDate
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QDate> #inclu ...
- vc2015编译protobuf
下载地址:https://github.com/google/protobuf 1.编译通过cmake生成sln文件来编译用cmd命令 cd 到3.0.0-beta-4\cmake mkdir bui ...
- attachEvent和addEventListener
attachEvent和addEventListener在前端开发过程中经常性的使用,他们都可以用来绑定脚本事件,取代在html中写obj.onclick=method. 相同点: 它们都是dom对象 ...
- Ubuntu 修改 Apache2 用户组 方法
检查/etc/apache2/envvars文件,发现其中需要使用/etc/apache2/envvars文件中的以下几个环境变量 export APACHE_RUN_USER=www-data ex ...
- 求实现sql?
id name pid1 曾祖父 02 祖父 13 父亲 24 儿子 35 孙子 4备注:用一条数据库语句来解决查询结果:name1 name2 name3曾祖父 祖父 父亲曾祖父 父亲 儿子曾祖父 ...
- cocos2d-js 入门一 ([isNaN()和isFinite(),字符和Number之间的转化)
isNaN() : 用于检查其参数是否是非数字值.// 提示:是非数字哦.(not a number)document.write(isNaN(0) ) //返回falsedocument.writ ...
- [TYVJ] P1423 GF和猫咪的玩具
GF和猫咪的玩具 描述 Description GF同学和猫咪得到了一个特别的玩具,这个玩具由n个金属环(编号为1---n),和m条绳索组成,每条绳索连接两个不同的金属环,并且长度相同.GF左手拿起金 ...
- 去掉Eclipse打开后定期弹出Usage Data Upload对话框
Eclipse 的 UDC 老定期蹦出来说要上传使用数据到 eclipse 官网服务器去除方法: 1.删除 eclipse/plugins 目录下以 org.eclipse.epp.usagedata ...
- PHP中$_GET['name']与$_POST['name']变量直接用变量名$name的php配置
php中,可以直接使用参数名称作为变量来接收get或post的传参,条件是php.ini中register_global设置成On 另外一种方法: if(!ini_get('register_glob ...
- Powershell环境变量
Powershell环境变量 9 12月, 2011 在 Powershell tagged 变量by Mooser Lee 本文索引 [隐藏] 1读取特殊的环境变量 2查找环境变量 3创建新的环境 ...