中文字幕精品无码一区二区,成全视频在线播放观看方法,大伊人青草狠狠久久,亚洲一区影音先锋色资源

第四課 累加求和 文字素材

資源下載
  1. 二一教育資源

第四課 累加求和 文字素材

資源簡介

【121105002·Design】數(shù)列第一項為81,此后各項均為它前一項的正平方根,統(tǒng)計該數(shù)列前30項之和后,并以格式"%.3f"寫入到考生文件夾下的新建文件Designl.dat。(frequency:3)
#include

#include

void
main()
{
FILE
p;
float
s=0,a=81;int
i;
/
考生在這里添加代碼
/
}
【answer】
#include

#include

void
main()
{
FILE
p;
float
s=0,a=81;int
i;
for(i=1;i<=30;i++)
{
s=s+a;
a=sqrt(a);
}
p=fopen("Design1.dat","w");
fprintf(p,"%.3f
",a);
fclose(p);
}
【121105004·Design】計算多項式a0-a1
x+a2
x
x/2!-a3
x
x
x/3!+…-a9
x
x
x
x
x
x
x
x
x/9!的值,并將結果一格式"%f"寫入
到考生文件夾中Paper子文件夾下的新建文件Des
ign1.dat。(frequency:2)
#include

#include

void
main()
{
FILE
p;
int
i;
float
x=1.279,t,y;
float
a[10]={1.1,3.2,-2.5,5.67,3.42,-4.5,2.54,5.6,0.97,4.65};
/
考生在這里添加代碼
/
}
【answer】
#include

#include

void
main()
{
FILE
p;
int
i;
float
x=1.279,t,y;
float
a[10]={1.1,3.2,-2.5,5.67,3.42,-4.5,2.54,5.6,0.97,4.65};
y=a[0];
t=-x;
for(i=1;i<=9;i++)
{
y=y+a[i]
t;
t=-t
x/(i+1);
}
p=fopen("design1.dat","w");
fprintf(p,"%f",y);
fclose(p);
}
【121105006·Design】計算表達式1+2!+3!……+12!的值,并將計算結果以格式"%ld"寫入到考生文件夾中paper子文件夾下的新建文件Design2.dat。
#include

void
main()
{
FILE
p;
long
s=1,k=1;
int
i;
/
考生在這里添加代碼
/
}
【answer】
#include

void
main()
{
FILE
p;
long
s=1,k=1;
int
i;
for(i=2;i<=12;i++)
{
k=k
i;
s=s+k;
}
p=fopen("design1.dat","w");
fprintf(p,"%ld",s);
fclose(p);
}
【121105010·Design】設計編寫并運行程序,完成以下功能:利用公式ㄦ/4=1-1/3+1/5-1/7
+……..公式計算的近似值
,直到某一項的絕對值小于1e-6為止。(將結果不包含此項)將計算結果以格式寫入到考生文件夾中Paper子文件夾下的新建Design2.dat。
#include

#include

void
main()
{
FILE
fp;
float
n=1,t=1,pi=0;
int
i;
/
考生在這里添加代碼
/
}
【answer】
#include

#include

void
main()
{
FILE
fp;
float
n=1,t=1,pi=0;
int
i;
while(fabs(n
1/t)>=1e-6)
{
pi=pi+n
1/t;
n=-n;
t=t+2;
}
fp=fopen("Desing2.dat","w");
fprintf(fp,"%f",4
pi);
fclose(fp);
}
【121105014·Design】有數(shù)列:2/1,3/2,5/3,8/5,13/8,21/13,.......求出數(shù)列的前40項的和。將計算結果以格式"%.6f"寫入到考生文件夾中Paper子文件夾下的新文件夾Design2.dat。
#include
void
main()
{
FILE
p;
int
i;
float
f1=1.0,f2=2.0,t1=2.0,t2=3.0,s;
float
f,t;
s=t1/f1+t2/f2;
/
考生在這里添加代碼
/
}
【answer】
#include
void
main()
{
FILE
p;
int
i;
float
f1=1.0,f2=2.0,t1=2.0,t2=3.0,s;
float
f,t;
s=t1/f1+t2/f2;
for(i=3;i<=40;i++)
{
f=t2;
t=t2+f2;
s=s+t/f;
t2=t;
f2=f;
}
p=fopen("design2.dat","w");
fprintf(p,"%.6f",s);
fclose(p);
}
【121105028·Design】x[i],y[i]分別表示平面上一點的坐標,求下列10個點與點(1.0,1.0)的距離的總和,并將結果以格式"%.6f"寫入到考生文件夾中paper子文件夾下的新建文件design1.dat。
#include
#include
void
main()
{
FILE
p;
int
i;
float
x[10]={-1.5,2.1,6.3,3.2,-0.7,7.0,5.1,3.2,4.5,7.6};
float
y[10]={3.5,7.6,8.1,4.5,6.0,1.1,1.2,2.1,3.3,4.4};
float
s=0.0;
/
考生在這里添加代碼
/
}
【answer】
#include
#include
void
main()
{
FILE
p;
int
i;
float
x[10]={-1.5,2.1,6.3,3.2,-0.7,7.0,5.1,3.2,4.5,7.6};
float
y[10]={3.5,7.6,8.1,4.5,6.0,1.1,1.2,2.1,3.3,4.4};
float
s=0.0;
for(i=0;i<10;i++)
s=s+sqrt(
(x[i]-1.0)
(x[i]-1.0)+(y[i]-1.0)
(y[i]-1.0)
);
p=fopen("Design1.dat","w");
fprintf(p,"%.6",s);
fclose(p);}

展開更多......

收起↑

資源預覽

<pre id="tfb94"><li id="tfb94"></li></pre>

<bdo id="tfb94"><rt id="tfb94"></rt></bdo>
  • <menu id="tfb94"><dl id="tfb94"></dl></menu><i id="tfb94"><acronym id="tfb94"><sub id="tfb94"></sub></acronym></i>

    1. 主站蜘蛛池模板: 化隆| 阜新市| 临海市| 布尔津县| 贵溪市| 永安市| 大田县| 和龙市| 新邵县| 南宁市| 威信县| 循化| 龙州县| 肥乡县| 长宁区| 武宁县| 宁化县| 历史| 镇坪县| 吉首市| 含山县| 司法| 柳河县| 丰台区| 宜丰县| 开阳县| 锡林浩特市| 阿城市| 武穴市| 永靖县| 新巴尔虎右旗| 基隆市| 嘉荫县| 凤阳县| 胶州市| 上虞市| 牡丹江市| 通河县| 岚皋县| 烟台市| 彰化县|