文件名称:sumfib
下载
别用迅雷、360浏览器下载。
如迅雷强制弹出,可右键点击选“另存为”。
失败请重下,重下不扣分。
如迅雷强制弹出,可右键点击选“另存为”。
失败请重下,重下不扣分。
介绍说明--下载内容均来自于网络,请自行研究使用
I am trying to write a program that uses a for loop to output the Fibonacci series to the number inputted. I have put the program I have so far, but am having trouble with getting the sum of all the terms
Here are some examples of what the output should look like:
Enter the number of terms in the Fibonacci series>2
F[2] = 0 + 1 = 1
Enter the number of terms in the Fibonacci series>4
F[4] = 0 + 1 + 1 + 2 = 4
Enter the number of terms in the Fibonacci series>8
F[8] = 0 + 1 + 1 + 2 + 3 + 5 + 8 + 13 = 33
I would rather not use the fib function...is there a way to solve my problem within the loop I already have or by using another loop in the if statement at the very end of my program?
Here are some examples of what the output should look like:
Enter the number of terms in the Fibonacci series>2
F[2] = 0 + 1 = 1
Enter the number of terms in the Fibonacci series>4
F[4] = 0 + 1 + 1 + 2 = 4
Enter the number of terms in the Fibonacci series>8
F[8] = 0 + 1 + 1 + 2 + 3 + 5 + 8 + 13 = 33
I would rather not use the fib function...is there a way to solve my problem within the loop I already have or by using another loop in the if statement at the very end of my program?
(系统自动生成,下载前可以参看下载内容)
下载文件列表
sumfib.cpp