EULER Q1 Solution

 #include <iostream>

using namespace std;
int fib(int x) {
if((x==1)||(x==0)) {
return(x);
}else {
return (fib(x-1)+fib(x-1));
}
}
int main() {
int x , i=0;
cout << "Enter the number of terms of series : ";
cin >> x;
cout << "\nFibonnaci Series : ";
while(i < x) {
cout << " " << fib(i);
i++;
}
cout<<endl;
return 0;
}

Comments

Popular posts from this blog

COMPRESSING FILES IN LINUX

What is the difference between Coder, Programmer& Developer, Software engineer?

MAKING A BOOTABLE DRIVE IN LINUX CLI