Function Fibseq (n)
The above Function generates the fibonacci sequence of a given number, in a recursive manner.
Step 1 Is zero ?
if (n = 0) then
return 0
Step 2 Is one ?
if (n = 1) then
return 1
Step 3 number is greater than 1, recursive call if (n > 1) then
return (Fibseq (n – 1) + Fibseq (n – 2))
No comments:
Post a Comment