PL/SQL Program to Check Number is Even or Odd

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

declare
num number;
r number;
begin
num:=:num;
r:=mod(num,2);
case r
when 0 then
 dbms_output.put_line(num||' is EVEN Number');
else
 dbms_output.put_line(num||' is ODD Number');
end case;
end;

OUTPUT:

3 is ODD Number
---------------------------
8 is EVEN Number

You may also like...

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.