- 1、本文档共46页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C语言题库1(国外英语资料)
C语言题库1(国外英语资料)
//1, known: Sn=2/1+3/2+4/3+... + (n+1) /n, which asks Sn not to exceed the maximum value of 50 (third to four after five decimal places)
#include stdio.h
Void, main ()
{
Int n=1;
Float s=0;
While (s=50)
{s=s+ (n+1) *1.0/n;
N++;}
Printf (%.3f, s-n*1.0/ (n-1));
}
//2, known S1=2, S2=2+4, S3=2+4+6, S4=2+4+6+8, S5=2+4+6+8+10,... Seek S=S1+S2+S3+S4+S5+... Value of +S20.
#include stdio.h
Void, main ()
{
Int, I, t=0;
Int s=0;
For (i=1; i=20; i++)
{t=t+2*i;
S=s+t;
}
Printf (%d, s);
}
//3, set S=1+1/2+1/3+... 1/n, n is a positive integer, the S does not exceed 10 (S = 10) of the largest n.
#include stdio.h
Void, main ()
{
Int n=1;
Float s=0;
While (s=10)
{s=s+1.0/n;
N++;
}
Printf (%d, n-2);
}
//4, set S (n) =1-1/3+1/5-1/7+... 1/ (2n-1), for the value of S (100), requires S (100) to press four Five into the way, accurate to 4 decimal places.
#include stdio.h
Void, main ()
{
Int i;
Float s=0;
For (i=1; i=100; i++)
If (i%2==1) s=s+1.0/ (2*i-1);
Else s=s-1.0/ (2*i-1);
Printf (%.4f, s);
}
//5, mathematical formula 1-1/2+1/3-1/4+1/5-1/6+... Value of +1/99-1/100. (4 to four after five decimal places)
#include stdio.h
Void, main ()
{
Int i;
Float s=0;
For (i=1; i=100; i++)
If (i%2==1) s=s+1.0/i;
Else s=s-1.0/i;
Printf (%.4f, s);
}
//6 when n=100 is calculated, S= (1-1/2) + (1/3-1/4) +...... The value of (1/ (2n-1) -1/ (2n)). Requirements: press four Five into the way, accurate to third decimal places.
#include stdio.h
Void, main ()
{
Int i;
Float s=0;
For (i=1; i=100; i++)
S=s+1.0/ (2*i-1) -1.0/ (2*i);
Printf (%.3f, s);
}
//7 is known as S=1+1/ (1+2) +1/ (1+2+3) +... +1/ (1+2+3+... +N) when the value of N is 50, the value of S is determined. Requirement: press four Five into the way, accurate to fourth decimal places.
#include stdio.h
Void, main ()
{
Int, I, t=0;
Float s=0;
For (i=1; i=50; i++)
{t=t+i;
S=s+1.0/t;}
Printf (%.4f, s);
}
//8 asks Y=1-1/2+1/3-1/4+1/5... The sum of the first 30. Requirement: press four Five into the way, accurate to second decimal places
#i
您可能关注的文档
最近下载
- 2021上海春考作文题“走进阳光的能力……解析及范文.docx VIP
- 学前儿童美术教育活动指导形成性考核一.docx
- 国庆节新中国成立75周年 全文.pptx
- 冀教版九年级英语上册 (Staying Safe in an Earthquake)Safety 课件.pptx
- 三七中总皂苷提取工艺流程方案论文.pdf
- 2024成都道法中考试题研究备考 真题精练(含答案).doc
- 福建省厦门市2021-2022学年九年级上学期期末考英语试卷.pdf VIP
- 2022-2023学年福建省厦门市九年级上学期期末考英语试卷含详解.docx VIP
- CAD系统变量参数解析(最全最详细).docx
- 市场行为的宝藏系列研究二:抢跑者的脚步声,基于价量互动的选股因子.pdf VIP
文档评论(0)