Hello,I am calculating the first 20 Fibonacci numbers using a function,but getting wrong answer.The condition is to write a function not a procedure. here is my try,help me.create function fn_fibo(@end int)returns intasbegindeclare @a int, @b int,@fib intset @a = 0set @b = 1set @fib = 0while @fib < @endbegin set @fib = @a + @b set @a = @b set @b = @fibendreturn @fibendselect dbo.fn_fibo(20)
↧