Write PLSQL block to display the ODD numbers and total odd numbers in given number? Ex: If given number is 3, display as below 1 is odd number 3 is odd number Total 2 odd numbers in 3
CREATE OR REPLACE PROCEDURE odd_num(p_num NUMBER )
IS s_num NUMBER;
BEGIN
FOR i_num IN 1..p_num
LOOP
IF mod(i_num,2) = 1
THEN
dbms_output.put_line(i_num ||' is Odd Number');
END IF;
END LOOP;
dbms_output.put_line('Total '|| s_num ||' Odd Numbers in '||p_num);
END;
s_numand then increment it in theifstatement in your loop.