Check whether a given number is even or odd in PL/SQL
Prerequisite – PL/SQL introduction
In PL/SQL code groups of commands are arranged within a block. A block group related declarations or statements. In declare part, we declare variables and between begin and end part, we perform the operations.
Attention reader! Don’t stop learning now. Learn SQL for interviews using SQL Course by GeeksforGeeks.
Input: 2 Output: even Input: 5 Output: odd
The approach is to divide the given number by 2 and if the remainder is 0 then the given number is even else odd.
Below is the required implementation: