C++ program that Display a Fibonacci Series (that allow a user to enter the limit)
#include <iostream>
using namespace std;
int main()
{
int limit;
int a=0,b=1,c;
cout<< "Enter the Fibonacci series limit : ";
cin>>limit;
for(c=0;c<=limit;c=a+b){
a=b;
b=c;
cout<<c;
if(b=c){
cout<< " ";
}
}
return 0;
}
No comments:
Post a Comment