मराठी
महाराष्ट्र राज्य शिक्षण मंडळएचएससी विज्ञान (संगणक विज्ञान) इयत्ता १२ वी

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

Advertisements
Advertisements

प्रश्न

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

कोड लेखन
Advertisements

उत्तर

    #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
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2021-2022 (March) Set 1

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×