Q:

Write a PL/SQL program to check whether a number is even or odd

0

Write a PL/SQL program to check whether a number is even or odd

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

DECLARE
n1 NUMBER := &num1;
BEGIN
-- test if the number provided by the user is even
IF MOD(n1,2) = 0 THEN
DBMS_OUTPUT.PUT_LINE ('The number. '||n1||
' is even number');
ELSE
DBMS_OUTPUT.PUT_LINE ('The number '||n1||' is odd number.');
END IF;
DBMS_OUTPUT.PUT_LINE ('Done Successfully');
END;
/

Sample Output:

Enter value for num1: 19
old   2: n1 NUMBER := &num1;
new   2: n1 NUMBER := 19;
The number 19 is odd number.
Done Successfully

PL/SQL procedure successfully completed.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now