当前位置:网站首页>Zzuli:1040 sum of sequence 1
Zzuli:1040 sum of sequence 1
2022-07-03 14:33:00 【Snake_____】
Title Description
Enter an integer n, Output sequence 1+1/3+1/5+…… front n Sum of items .
Input
Enter only one positive integer n.
Output
The result is reserved 2 Decimal place , Take a line alone
The sample input Copy
3
Sample output Copy
1.53
#include <stdio.h>
int main()
{
int n,i;
double t,den=1,sum=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
t=1/den;
sum=sum+t;
den=den+2;
}
printf("%.2lf",sum);
return 0;
}边栏推荐
- How to query the baby category of tmall on Taobao
- China PETG market forecast and Strategic Research Report (2022 Edition)
- MySQL multi table query subquery
- 【7.3】146. LRU caching mechanism
- 【7.3】146. LRU缓存机制
- LNMP环境mail函数不能发送邮件解决
- Paper sharing: generating playful palettes from images
- 洛谷P3065 [USACO12DEC]First! G 题解
- Mysql多表查询 #子查询
- dllexport和dllimport
猜你喜欢

adc128s022 ADC verilog设计实现

pyQt界面制作(登录+跳转页面)

Why is this error reported when modifying records in the database

Leetcode (4) -- find the median of two positively ordered arrays

Sword finger offer 28 Symmetric binary tree

泰凌冲刺科创板:拟募资13亿 国家大基金与小米长江是股东
![Luogu p4047 [jsoi2010] tribal division solution](/img/7f/3fab3e94abef3da1f5652db35361df.png)
Luogu p4047 [jsoi2010] tribal division solution

Code writing and playing method of tonybot humanoid robot at fixed distance

Accelerating strategy learning using parallel differentiable simulation

Showmebug entered Tencent conference, opening the era of professional technical interview
随机推荐
Analysis of gene family characteristics - chromosome location analysis
Pyqt interface production (login + jump page)
Find the sum of the elements of each row of the matrix
C language,%d% Difference between 2D%2d%02d
Polestar美股上市:5.5万台交付如何支持得起超200亿美元估值
Mysql多表查询 #子查询
Luogu p3065 [usaco12dec]first! G problem solution
光猫超级账号密码、宽带账号密码 获取
7-22 tortoise and rabbit race (result oriented)
JVM garbage collector
US stock listing of polar: how can the delivery of 55000 units support the valuation of more than 20billion US dollars
常见问题之PHP——ldap_add(): Add: Undefined attribute type in
Niuke: crossing the river
2021年区域赛ICPC沈阳站J-Luggage Lock(代码简洁)
FPGA blocking assignment and non blocking assignment
分布式事务(Seata) 四大模式详解
LNMP环境mail函数不能发送邮件解决
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
7-15 calculation of PI
7-20 print 99 formula table (format output)