PL/SQL program to print odd numbers

Q. Write a PL/SQL program to print odd numbers between 1 to 10.

Answer:

The following PL/SQL code will print odd numbers between 1 to 10.

declare
n number := 1;
begin
while n<=10
loop
dbms_output.put_line(n);
n := n+2;
end loop;
end;
/


Output:

odd number