Fibonacci - Tabulated 1d array manipulation

 data: lt_d type table of i,

    wa_d type i,

    lv_ind type i value 3,

    lv_inp type i value 7.

lt_d = VALUE #( ( 0 ) ( 1 ) ).

do ( lv_inp - 2 ) times.

wa_d = lt_d[ lv_ind - 1 ] + lt_d[ lv_ind - 2 ].

append wa_d to lt_d.

lv_ind = lv_ind + 1.

enddo.


write: lt_d[ lv_inp ].


Comments

Popular posts from this blog

Can Reach program ( 1 d arrray)

Bubble Sort