当前位置:网站首页>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;
}边栏推荐
- Common shortcut keys in PCB
- puzzle(016.4)多米诺效应
- 7-16 find the set of integers that meet the given conditions
- 7-4 BCD decryption (10 points)
- Understand the application scenario and implementation mechanism of differential segment
- 剑指 Offer 28. 对称的二叉树
- 分布式事务(Seata) 四大模式详解
- 适用于XP的DDK
- 7-15 calculation of PI
- 556. The next larger element III
猜你喜欢

Why is this error reported when modifying records in the database

Use of constraintlayout

Eight sorts
![Luogu p5018 [noip2018 popularization group] symmetric binary tree problem solution](/img/89/da1a3a38e02671628f385de0f30369.png)
Luogu p5018 [noip2018 popularization group] symmetric binary tree problem solution

GRPC的四种数据流以及案例

MySQL multi table query subquery
![[qingniaochangping campus of Peking University] in the Internet industry, which positions are more popular as they get older?](/img/f6/fe61c84f289f0e74a45946dac687a6.jpg)
[qingniaochangping campus of Peking University] in the Internet industry, which positions are more popular as they get older?

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

Thinking about the arrangement problem in the backtracking problem (leetcode questions 46 and 47)

puzzle(016.4)多米诺效应
随机推荐
7-22 tortoise and rabbit race (result oriented)
7-14 sum integer segments (C language)
Output student grades
Strategy, tactics (and OKR)
动态获取权限
Sendmail can't send mail and it's too slow to send. Solve it
puzzle(016.3)千丝万缕
Add ZABBIX calculation type itemcalculated items
Tonybot humanoid robot starts for the first time 0630
洛谷P3065 [USACO12DEC]First! G 题解
ZABBIX saves the page blank after adding calculated items
Some concepts about agile
Leetcode (4) - - trouver la médiane de deux tableaux ordonnés positifs
Detailed explanation of four modes of distributed transaction (Seata)
别再问自己适不适合做软件测试了
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
添加Zabbix计算类型项目Calculated items
MongoDB数据库入门的常用命令
Zabbix添加Calculated items后保存页面成空白
[clean up the extraordinary image of Disk C]