• Post Reply Bookmark Topic Watch Topic
  • New Topic

Storing the last value in a sequence?  RSS feed

 
Brandon Choate
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yo! I've been working on a Fibonacci Generator class for awhile now.

The code for the sequence itself is perfectly fine. The bit that allows you to input a number and calculate the place for it, however, has a few problems.

Here is the code:


If I were to put in "4" for n, it'd put out fib(4) = 1
1
3
5

How do I store the last value in the sequence and put it at the end of that equals sign?
Thanks in advance.
 
Ankit Garg
Sheriff
Posts: 9610
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please elaborate your problem a little better (Is it only me who is not able to understand the problem )...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!