文件名称:sumfib
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:5.71kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
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
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.