+ 2
How can I print the fibonacci series of 10 numbers in the reverse order?
the output would be like :- 55 34 21 13 8 5 3 2 1 1
12 Respostas
+ 7
The easiest way is to calculate and store them in an array and print the array contents in reverse order.
+ 7
Another option call the function 10 times with n of 10 to 1.
+ 6
for (int n = 10; n > 0; n--)
System.out.println(fibonacci(n));
+ 5
Given you have the last two values, you can calculate all the others. 55 - 34 gives 21, 34 - 21 gives 13, ectereta.
+ 3
oh.. okk.. thank you.. for your help.đ
+ 2
what if we don't have the values then?
+ 2
mm.. i didn't get.. actually its new for me!
+ 2
thank you so much..đ @Forge
+ 1
thank you.. but i'm in search of this program without using an array!
+ 1
Not sure my section on building the sequence is the best way to do it, but it worked for me.. Either way, the rest stands. as John said, put it into an ArrayList and then you can manipulate it as you need
+ 1
i've got the output.. thank you guys for your help!đ