English

Write C++ program to generate and print first 15 terms of fibonacci series (1, 1, 2, 3, 5.........) - Computer Science 1

Advertisements
Advertisements

Question

Write C++ program to generate and print first 15 terms of fibonacci series (1, 1, 2, 3, 5.........)

Code Writing
Advertisements

Solution

    #include<iostream.h>
    void main()
    {
    int f0, f1, f, n;
    f0 = 0;
    f1 = 1;
    clrser();
    cout<<"Fibbonacci series \n";
    cout<<"\n" <<f0<<"\n"<<f1;
    for (n=1; n<=13; n++)
    {
        f = f0 + f1;
        cout<<"\n"<<f;
        f0 = f1;
        f1 = f;
    }
}
shaalaa.com
  Is there an error in this question or solution?
2021-2022 (March) Set 1

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×