C程序,有一分数序列:2/1 3/2 5/3 8/5 13/8 21/13.求出这个数列的前N项之和,保留两位小数.#include 我不怎么会用数组int main(){\x05float j,nume=2,i,N,d[100]={0,1,2};\x05\x05float s=0;\x05scanf("%f",&N);\x05\x05for(i=1;i
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/25 19:56:20
![C程序,有一分数序列:2/1 3/2 5/3 8/5 13/8 21/13.求出这个数列的前N项之和,保留两位小数.#include 我不怎么会用数组int main(){\x05float j,nume=2,i,N,d[100]={0,1,2};\x05\x05float s=0;\x05scanf(](/uploads/image/z/8851487-23-7.jpg?t=C%E7%A8%8B%E5%BA%8F%2C%E6%9C%89%E4%B8%80%E5%88%86%E6%95%B0%E5%BA%8F%E5%88%97%EF%BC%9A2%2F1+3%2F2+5%2F3+8%2F5+13%2F8+21%2F13.%E6%B1%82%E5%87%BA%E8%BF%99%E4%B8%AA%E6%95%B0%E5%88%97%E7%9A%84%E5%89%8DN%E9%A1%B9%E4%B9%8B%E5%92%8C%2C%E4%BF%9D%E7%95%99%E4%B8%A4%E4%BD%8D%E5%B0%8F%E6%95%B0.%23include+%E6%88%91%E4%B8%8D%E6%80%8E%E4%B9%88%E4%BC%9A%E7%94%A8%E6%95%B0%E7%BB%84int+main%28%29%7B%5Cx05float+j%2Cnume%3D2%2Ci%2CN%2Cd%5B100%5D%3D%7B0%2C1%2C2%7D%3B%5Cx05%5Cx05float+s%3D0%3B%5Cx05scanf%28%22%25f%22%2C%26N%29%3B%5Cx05%5Cx05for%28i%3D1%3Bi)
C程序,有一分数序列:2/1 3/2 5/3 8/5 13/8 21/13.求出这个数列的前N项之和,保留两位小数.#include 我不怎么会用数组int main(){\x05float j,nume=2,i,N,d[100]={0,1,2};\x05\x05float s=0;\x05scanf("%f",&N);\x05\x05for(i=1;i
C程序,有一分数序列:2/1 3/2 5/3 8/5 13/8 21/13.求出这个数列的前N项之和,保留两位小数.
#include 我不怎么会用数组
int main()
{
\x05float j,nume=2,i,N,d[100]={0,1,2};
\x05
\x05float s=0;
\x05scanf("%f",&N);
\x05
\x05for(i=1;i
C程序,有一分数序列:2/1 3/2 5/3 8/5 13/8 21/13.求出这个数列的前N项之和,保留两位小数.#include 我不怎么会用数组int main(){\x05float j,nume=2,i,N,d[100]={0,1,2};\x05\x05float s=0;\x05scanf("%f",&N);\x05\x05for(i=1;i
不用数组也行
scanf("%f",&N);
int a = 1, b = 2, c = 0, s = 0;
for (int i = 0; i < N; i++)
{
s += b / a;
c = b;
b = a + b;
a = c;
}