- Related Questions & Answers
- Fibonacci series program in Java without using recursion.
- Fibonacci series program in Java using recursion.
- C++ Program to Find Fibonacci Numbers using Recursion
- Python Program to Display Fibonacci Sequence Using Recursion
- Python Program to Find the Length of the Linked List without using Recursion
- Find fibonacci series upto n using lambda in Python
- Python Program to find the factorial of a number without recursion
- Python Program to Flatten a List without using Recursion
- Python Program to Reverse a String without using Recursion
- How to get the nth value of a Fibonacci series using recursion in C#?
- C++ Program to Display Fibonacci Series
- Python Program to Find the Sum of Digits in a Number without Recursion
- C program to find Fibonacci series for a given number
- Python Program to Implement Binary Search without Recursion
- Factorial program in Java without using recursion.

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

When it is required to find the Fibonacci series without using recursion technique, the input is taken from the user, and a ‘while’ loop is used to get the numbers in the sequence.

Below is a demonstration for the same −

first_num = int(input("Enter the first number of the fibonacci series... ")) second_num = int(input("Enter the second number of the fibonacci series... ")) num_of_terms = int(input("Enter the number of terms... ")) print(first_num,second_num) print("The numbers in fibonacci series are : ") while(num_of_terms-2): third_num = first_num + second_num first_num=second_num second_num=third_num print(third_num) num_of_terms=num_of_terms-1

Enter the first number of the fibonacci series... 2 Enter the second number of the fibonacci series... 8 Enter the number of terms... 8 2 8 The numbers in fibonacci series are : 10 18 28 46 74 120

- The first number and second number inputs are taken from the user.
- The number of terms is also taken from the user.
- The first and the second numbers are printed on the console.
- A while loop begins, and the below takes place −
- The first and second numbers are added and assigned to a third number.
- The second number is assigned to the third number.
- The third number is assigned to the second number.
- The third number is printed on the console.
- The number of terms is decremented by 1.

Advertisements