Programming for Problem Solving (3110003)

BE | Semester-1   Winter-2019 | 07-01-2020

Q4) (b)

Develop an algorithm to print first N Fibonacci numbers.

  1. Start
  2. Declare variables i, a, b, c, N
  3. Initialize the variables, i = 0, a = 0, b = 1, and c = 0
  4. Enter the number of terms of Fibonacci series to be printed
  5. Print First two terms a, b
  6. Use loop for the following steps until i < N
    • c = a + b
    • a = b
    • b = c
    • increase value of i each time by 1
    • print the value of c
  7. End