Java

Fibnumber = Math.round(Math.pow((1+Math.sqrt(5))/2, number) / Math.sqrt(5));

but power, square root and division on floating point are all eating a lot of cpu clock cycles, it may prove more economical to compute each value of the sequence because the next value only require an integer addition.

Executing your code step by step may help you to understand what the code is doing and what is missing.

You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.

The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.

Debugger - Wikipedia, the free encyclopedia[^]

Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]

http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html[^]

https://www.jetbrains.com/idea/help/debugging-your-first-java-application.html[^]

The debugger is here to show you what your code is doing and your task is to compare with what it should do.

Advice: build some functions for each part of the problem, it help to handle changes without breaking other things.

All you need to do is move that line inside an

`if (number >= 1 && number <= 46) { ... }`

block, and output the result.If the user enters a number above 2, then you will need to compute the vale nth Fibonacci number by using a loop.

Rather than using the rounding method and powers of the golden ratio, the assignment is expecting you to calculate the sequence using a

`for`

loop, adding the previous two numbers together at each step.It's not as efficient as your current calculation, but I guess it's testing how well you understand loops, rather than how good your maths is. :)

Therather than6thnumber ...... is.8thDoes the program throwing any error? You have an incomplete statement