当前位置:网站首页>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;
}边栏推荐
- Zhonggan micro sprint technology innovation board: annual revenue of 240million, net loss of 17.82 million, proposed to raise 600million
- 7-14 sum integer segments (C language)
- Concat and concat_ Ws() differences and groups_ Use of concat() and repeat() functions
- Facebook 如何将 Instagram 从 AWS 搬到自己的服务器
- X86 assembly language - Notes from real mode to protected mode
- 洛谷P4047 [JSOI2010]部落划分 题解
- ZABBIX saves the page blank after adding calculated items
- 关于敏捷的一些概念
- Eight sorts
- 一文了解微分段应用场景与实现机制
猜你喜欢

Puzzle (016.3) is inextricably linked

556. The next larger element III

x86汇编语言-从实模式到保护模式 笔记

天谋科技 Timecho 完成近亿元人民币天使轮融资,打造工业物联网原生时序数据库

7-15 calculation of PI

Accelerating strategy learning using parallel differentiable simulation

Tonybot humanoid robot infrared remote control play 0630
![洛谷P4047 [JSOI2010]部落划分 题解](/img/7f/3fab3e94abef3da1f5652db35361df.png)
洛谷P4047 [JSOI2010]部落划分 题解

NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线

Programming language: the essence of type system
随机推荐
Convert string to decimal integer
Sword finger offer 28 Symmetric binary tree
Why is this error reported when modifying records in the database
Tonybot humanoid robot checks the port and corresponds to port 0701
Puzzle (016.3) is inextricably linked
【7.3】146. LRU缓存机制
牛客网:过河卒
protobuf与grpc
添加Zabbix计算类型项目Calculated items
MySQL multi table query subquery
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
Thread.sleep和TimeUnit.SECONDS.sleep的区别
Raft agreement
Mongodb index
Concat and concat_ Ws() differences and groups_ Use of concat() and repeat() functions
Tonybot humanoid robot infrared remote control play 0630
7-22 tortoise and rabbit race (result oriented)
Understanding of closures
NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线
C library function - qsort()