#include <iostream>
using namespace std; 
class fib 
{
    int n1=0,n2=1,n;
    public :
    fib (int num )
    {
        cout <<n1<<endl; 
        cout <<n2<<endl; 
        for (int i=0;i<num-2;i++)
        {
            n=n1+n2;
            cout <<n<<endl; 
            n1=n2;
            n2=n;
        }
    }
};
int main() {
    fib f(5);
    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: