PL/SQL Function to Check Number is Even or Odd

PL/SQL Function to Check Number is Even or Odd:



create or replace function evn_od(no in number)
return varchar is ans varchar(50);
begin
if(mod(no,2) = 0) then
ans:='Even Number';
else
ans:='Odd Number';
end if;
return(ans);
end;

Calling Function:

begin
dbms_output.put_line(evn_od(25));
end;

OUTPUT:

Odd Number

Leave a Reply

Your email address will not be published. Required fields are marked *

sixteen + thirteen =