Fibonacci series C++ Program with inline function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include<iostream> using namespace std; inline series(int num) { int a=0,b=1,t,j; cout<<"the fibonacci series is "<<a<<b; for(j=1; j<=num; j++) { t=a+b; cout<<t; a=b; b=t; } cout<<"\n"; } int main() { int n; cout<<"enter a number"; cin>>n; series(n); } |
Output
enter the number : 4
the fibonacci series is : 011235
FAQ
Fibonacci series C++ Program with inline function and with for loop. Fibonacci series C++ Program with inline function and with user define function. Fibonacci series C++ Program with for loop. Fibonacci series C++ Program with user define functions. Fibonacci series C++ Inline function example.