0
Can anyone write me a program usin C++ and loops to get the outputs 0,1,1,2,3,5,8,13,21,34,55.
The no.s start from 0 and every 3rd no. is the sum of the 2 previous no.s.
3 Answers
+ 5
unsigned long long u1 = 1, u0 = 0;
while(u0 < 55){
cout << u0 << ',';
u0 = (u1+=u0) - u0;
}
cout << u0 << endl;
+ 4
Here we go :-
https://code.sololearn.com/cPu73pvQ188Z/?ref=app
0
that is called fibonacci series