Thread: fibonacci numbers?????

  1. #1

    Unhappy fibonacci numbers?????

    We are supposed to use a for loop to get and display the first 10 fibonacci numbers. (1, 1, 2, 3, 5, 8, 13, 21, 34, 55) Starting with the 3rd number it is the sum of the previous two. So what kinda of loop or would i have to put in if then statements to get it to work. What about arrays?

  2. #2
    It is explained in here somewhere

  3. #3
    Registered User
    Join Date
    Oct 2001
    you would use a for loop

    first print the first 2 numbers

    for (i=0; i<total;i++)
    // then just your printout being num3

    the loop will stop when the total amount of times you want it to go through the loop is completed

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fibonacci numbers (using class)
    By -chr- in forum C++ Programming
    Replies: 3
    Last Post: 01-21-2009, 04:49 PM
  2. Logical errors with seach function
    By Taka in forum C Programming
    Replies: 4
    Last Post: 09-18-2006, 05:20 AM
  3. Fibonacci numbers in C
    By Alastor in forum C Programming
    Replies: 23
    Last Post: 10-10-2005, 01:45 PM
  4. the definition of a mathematical "average" or "mean"
    By DavidP in forum A Brief History of
    Replies: 7
    Last Post: 12-03-2002, 11:15 AM
  5. FIBONACCI NUMBERS, please help!
    By JamesAnthony23 in forum C Programming
    Replies: 5
    Last Post: 09-26-2002, 03:39 PM