Trending This Week:

test

Post Top Ad

Your Ad Spot

Friday, June 10, 2022

C++ Program to print Fibonacci series...



C++ Program to print Fibonacci series.


#include <iostream>

using namespace std;


int main() {

int i, n1=0,n2=1,n3;

for(i=1;i<=10;i++)//Dont enter more number here

{

    n3=n1+n2;

    n1=n2;

    n2=n3;

    cout << n3 << endl;    

}

return 0;

}

output :


No comments:

Post a Comment

Post Top Ad

Your Ad Spot