19. 求平方根序列前N项和
#include <stdio.h>
#include <math.h>
int main()
{
int i, n;
double item, sum;
while (scanf("%d", &n) != EOF)
{
sum = 0;
for (i = 1; i <= n; i++)
{
item = sqrt(i);
sum = sum+item;
}
printf("sum = %.2f\n", sum);
}
return 0;
}
19. 求平方根序列前N项和的更多相关文章
- 39. 求分数序列前N项和
求分数序列前N项和 #include <stdio.h> int main() { int i, n; double numerator, denominator, item, sum, ...
- 20. 求阶乘序列前N项和
求阶乘序列前N项和 #include <stdio.h> double fact(int n); int main() { int i, n; double item, sum; whil ...
- 11. 求奇数分之一序列前N项和
求奇数分之一序列前N项和 #include <stdio.h> int main() { int denominator, i, n; double item, sum; while (s ...
- 10. 求N分之一序列前N项和
求N分之一序列前N项和 #include <stdio.h> int main() { int i, n; double item, sum; while (scanf("%d& ...
- 循环-10. 求序列前N项和*
/* * Main.c * C10-循环-10. 求序列前N项和 * Created on: 2014年7月30日 * Author: Boomkeeper *******部分通过******* */ ...
- 练习2-14 求奇数分之一序列前N项和 (15 分)
练习2-14 求奇数分之一序列前N项和 (15 分) 本题要求编写程序,计算序列 1 + 1/3 + 1/5 + ... 的前N项之和. 输入格式: 输入在一行中给出一个正整数N. 输出格式: 在一行 ...
- 练习2-13 求N分之一序列前N项和 (15 分)
练习2-13 求N分之一序列前N项和 (15 分) 输入在一行中给出一个正整数N. 输出格式: 在一行中按照“sum = S”的格式输出部分和的值S,精确到小数点后6位.题目保证计算结果不超过双精度范 ...
- 练习2-15 求简单交错序列前N项和 (15 分)
练习2-15 求简单交错序列前N项和 (15 分) 本题要求编写程序,计算序列 1 - 1/4 + 1/7 - 1/10 + ... 的前N项之和. 输入格式: 输入在一行中给出一个正整数N. 输出格 ...
- 12. 求简单交错序列前N项和
求简单交错序列前N项和 #include <stdio.h> int main() { int denominator, flag, i, n; double item, sum; whi ...
随机推荐
- Circle(codevs 3134)
题目描述 Description 在一个圆上,有2*K个不同的结点,我们以这些点为端点,连K条线段,使得每个结点都恰好用一次.在满足这些线段将圆分成最少部分的前提下,请计算有多少种连线的方法 输入描述 ...
- IOS项目自动构建
# Sets the target folders and the final framework product. # 如果工程名称和Framework的Target名称不一样的话,要自定义FMKN ...
- javascript中window.open()与window.location.href的区别
window.open("www.baidu.com"); 只是表示打开这个页面,并不是打开并刷新baidu.com window.location.href="www. ...
- GDUT 校赛02 dp回文串
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABSkAAAIhCAIAAAAtmainAAAgAElEQVR4nOzdfaxkd33n+ZJacstqa3 ...
- [转载]有了 malloc/free 为什么还要 new/delete ?
malloc 与free 是C++/C 语言的标准库函数,new/delete 是C++的运算符.他们都可以用于申请动态内存和释放内存. 对于非内部数据类型的对象(如类对象)而言,光用m ...
- [LintCode] Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, comput ...
- NOI2012 : 迷失游乐园
终于补完NOI2012了好开心~ 题目大意:给定一棵树或者环套外向树,求出从中随机选一条简单路径的期望长度,环上点数不超过20. 设 d[x]表示x的度数,ch[x]表示x孩子个数 up[x]表示x向 ...
- Palindrome Partitioning II Leetcode java
题目: Given a string s, partition s such that every substring of the partition is a palindrome. Return ...
- Leetcode 第一遍刷完
2014/10/15 Leetcode第一刷总算结束,时间拖太长了,希望第二遍能快一点,争取一个月能刷完第二遍??哈哈哈哈
- [Unity2D]脚本基类MonoBehaviour介绍
Unity中的脚本都是继承自MonoBehaviour. MonoBehaviour 表示一个单一的行为.Unity中用户对游戏对象的操作被分割成若干个单一行为.每个单一行为都作为一个MonoBeha ...