#include<iostream> #include<iomanip> using namespace std; int main(){ int a=0,b=1,c,num; cout<<"enter the nujmber of terms: "<<endl; cin>>num; cout<<a<<' '<<b; for(int i=1;i<=num-2;i++){ c=a+b; a=b; b=c; cout<<' '<<c; } cout<<endl; return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter