Jump to content

Fibonacci sequence: Difference between revisions

m
→‎{{header|PL/SQL}}: Simplified the code (using CASE statement) and added error handling.
(Add MAD)
m (→‎{{header|PL/SQL}}: Simplified the code (using CASE statement) and added error handling.)
Line 8,471:
 
=={{header|PL/SQL}}==
<lang PL/SQL>Createcreate or replace Functionfunction fnu_fibonnacifnu_fibonacci(p_iNumberp_num integer) return integer is
return f integer;
nuP p integer;
is
nuFib q integer;
begin
nuP integer;
case when p_num < 0 then raise_application_error(-20001, 'Invalid input: ' || p_num, true);
nuQ integer;
when p_num in (0, 1) then f := p_num;
Begin
if p_iNumber is not null thenelse
if p_iNumber p :=0 then0;
nuFib q :=0 1;
For nuI for i in 2 ..p_iNumber p_num loop
Elsif p_iNumber=1 then
nuFib f :=1 p + q;
Else p := q;
nuP q :=0 f;
nuQ:=1 end loop;
end case;
For nuI in 2..p_iNumber loop
return(nuFibf);
nuFib:=nuP+nuQ;
end fnu_fibonacci;
nuP:=nuQ;
/</lang>
nuQ:=nuFib;
End loop;
End if;
End if;
return(nuFib);
End fnu_fibonnaci;</lang>
 
=={{header|Plain English}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.