Answers for "fibonacci series using iterative method"

0

fibonacci series using iterative method

#include <iostream>
using namespace std;
void fib(int num) {
   int x = 0, y = 1, z = 0;
   for (int i = 0; i < num; i++) {
      cout << x << " ";
      z = x + y;
      x = y;
      y = z;
   }
}
int main() {
   int num;
   cout << "Enter the number : ";
   cin >> num;
   cout << "\nThe fibonacci series : " ;
   fib(num);
   return 0;
}
Posted by: Guest on March-19-2021

Code answers related to "fibonacci series using iterative method"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language