Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

# Thread: fibonacci series in reverse order

1. ## fibonacci series in reverse order

how can we print Fibonacci series in reverse order like

55 34 21 13 8 5 3 2 1 1 0
using for loop

im just not able to figure out how to do it, please suggest me some logic to do it,
thanks

2. ## Re: fibonacci series in reverse order

How would you do it on paper, without a computer?

3. ## Re: fibonacci series in reverse order

by the sum of the previous two numbers

4. ## Re: fibonacci series in reverse order

Pretend you have a really dumb friend who doesn't really understand how Fibonacci works. Write out specific instructions (full sentences, not code) on a piece of paper that your friend could follow to accomplish your goal. Remember how dumb your friend is, so make sure the instructions are as short and simple as possible. If one of the instructions can be broken down into multiple steps, do it.

When you have those instructions written out, you'll have yourself an algorithm that you can start thinking about converting to code.

5. ## Re: fibonacci series in reverse order

ammm thats the problem even i not able to understand how can i print Fibonacci BACKWRADS
i can write a program to print Fibonacci series to Nth term no problem there
but printing it backwards is really confusing for me
lets say we have to start from 55 then next will be 34
so to print 34 we have to subtract 21 from 55, and that's the problem how can we find out what value do we have to subtract from upperbound, when the upperbound is entered by the user

6. ## Re: fibonacci series in reverse order

Say I give you a task: starting at 55, write down the Fibonacci sequence in reverse, on a piece of paper.

How would you accomplish this task? Hint: I didn't say you can't use other pieces of paper to write whatever you want on them.

Alternatively, you might look into something called Binet's formula.

7. ## Re: fibonacci series in reverse order

hi thx, i got it working like this , but in this case the user have to enter last two numbers instead of only last number

```
class fibo_r {

public static void main(String args[])
{
int a=89,b=55,c,d,i;
System.out.println(+a);
System.out.println(+b);
for(i=a;i>1;i=i-c)
{
c=a-b;
System.out.println(+c);
a=b;
b=c;
}
}

}```