Code doubt | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Code doubt

I have to write a logical program to get output of Fibonacci sequence 0 1 1 2 3 5 8 13 21 Any help would be appreciated I can write code for Fibonacci series but struggling to print in above pattern

7th Jan 2023, 11:47 AM
💖Cavalry💕
💖Cavalry💕 - avatar
1 Answer
+ 2
Did you try anything? Post your try.. Observe pattern : 5 rows by 2 loops : Until j=rows/2-i print space. Otherwise print number, for each i. For i = 0; j<rows/2-i = 5/2-0=2 and j>i+rows/2= j>2 print spaces, otherwise numbers. For i = 1; j<rows/2-1= 5/2-1=1 and j>i+rows/2= j>3 print spaces, otherwise numbers. ... Something similar, may not be exactly... Hope it helps...
7th Jan 2023, 2:02 PM
Jayakrishna 🇮🇳