My program needs to prompt the user to input a number, and using that number, I tell them what number in the Fibonacci sequence their input corresponds to.(adsbygoogle = window.adsbygoogle || []).push({});

So the Fibonacci sequence is 0 1 1 2 3 5 8 13

So if they input the number 6, the program will return "5" as the number in the sequence.

Anyone have any ideas how I would do this? I need a loop for it, I'm sure, and I was trying the "for" loop, but I can't figure out how to just give them the single number in the sequence, and not the whole sequence up to that number.

Thanks.

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Fibonacci sequence

Loading...

Similar Threads - Fibonacci sequence | Date |
---|---|

Fibonacci sequence problem C# | Aug 2, 2015 |

Fortran DO loop sequence confusion | Apr 25, 2014 |

Problems generalizing a number sequence | Apr 28, 2013 |

Representing numbers as sums of fibonacci numbers | Oct 25, 2011 |

Which Fibonacci number would you like me to compute | Apr 23, 2009 |

**Physics Forums - The Fusion of Science and Community**