Sunday, May 28, 2017

Odd and Even Number in Oracle PL/SQL

Here is a very simple program that I wrote using Oracle PL/SQL to ask the user to give a number and then our program will check and tell us if the given number is an ODD or EVEN Number using PL/SQL statements. The code is very easy to understand thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.






Sample Program Output


Program Listing

/* Odd and Even Number Program in Oracle PL/SQL           */
/* Written By Mr. Jake R. Pomperada                       */
/* Language : PL/SQL                                      */
/* Date     : May 28, 2017  Sunday                        */

SET SERVEROUTPUT ON

DECLARE
              
         title   varchar2(50) :='Odd and Even Number Program in PL/SQL';
         author   varchar2(50) :='Written By: Mr. Jake R. Pomperada,MAED-IT';
        
         num_value number:=&num_value;
              
    BEGIN
             
             dbms_output.put_line(chr(13)||chr(10) || UPPER(title));
             dbms_output.put_line(chr(13)||chr(10) || UPPER(author));
             
             
   IF MOD(num_value,2)=0
    THEN
                 dbms_output.put_line(chr(13)||chr(10) || 'The given number ' || num_value || ' is a EVEN Number.');
                 dbms_output.put_line(chr(13)||chr(10)); 
                 dbms_output.put_line('END OF PROGRAM');
    ELSE
                  dbms_output.put_line(chr(13)||chr(10) || 'The given number ' || num_value || ' is a ODD Number.');
                 dbms_output.put_line(chr(13)||chr(10)); 
                 dbms_output.put_line('END OF PROGRAM');
    END IF;
     
   END;
   



No comments:

Post a Comment