Please help where m i wrong ?
Fibonacci pattern
Hey @anisha2001singhal the rest of the code is fine you are just not taking into consideration the base cases where n =1 and n= 2 . regardless of what n is, your code will always print the first 2 rows.
You should add bases cases for n=1 and n=2 like this
if(n==1){ cout << 0 << endl; }else if(n==2){ cout << 0 << endl ; cout << 1 << " " << 1 << endl ; }
And the rest of the code in the else portion.
Hope it helps.
If your doubt is resolved please mark it as resolved and rate me accordingly . Thank you. 
1 Like