Asked by JILL
write a program to print fibonaaci series like 2,1,3,4,7,11,18 up to 10th term using function...end function
I did it using SUB..end sub in this way :
declare sub series
cls
call series
end
sub series
a=2
b=1
for p =1 to 5
print a; b
a=a + b
b=b + a
next p
end sub
How do you do it using FUNCTION...END FUNCTION
0 following
I did it using SUB..end sub in this way :
declare sub series
cls
call series
end
sub series
a=2
b=1
for p =1 to 5
print a; b
a=a + b
b=b + a
next p
end sub
How do you do it using FUNCTION...END FUNCTION
0 following
Answers
Answered by
Steve
use the function to calculate the nth fib #, and return its value.
Then loop for p=1..5 and print each value returned.
Then loop for p=1..5 and print each value returned.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.