SQL program for finding the odd or even


PL/SQL PROGRAM   ODD OR EVEN
AIM:
To write a program to create functions for finding the odd or even numbers

 ALGORITHM:

                        Step 1:  Start the program
                        Step 2: declare the variables
                        Step 3 : get the values of a
Step 4:  check whether a mod 2 is equal to 0
Step 5:  then print number is even else print the number is odd
Step 6 : Stop the program


PROGRAM:

SQL> set serveroutput on
SQL> declare A number(5);
                        2  begin
                        3  a:=&a;
                        3  if(A mod 2=0) then
                        4  dbms_output.put_line('number of odd');
                        5  else
                        6  dbms_output.put_line('number of odd');
                        7  end if;
                        8  end;
                        9  /


OUTPUT:
Enter the number := 15
number of odd

PL/SQL procedure successfully completed.

0 comments:

Post a Comment