PL/SQL program for reverse of a number

In this example, you will take input from a user and find the reverse of a number in the PL/SQL program.

For example reverse of the number 1354 is 4531.

declare
no number;
rev number:=0;
remainder number;
begin
no:=&no;
while (no>0)
loop
  remainder := mod(no,10);
  rev := rev * 10 + remainder;
  no := floor(no/10);
end loop;
dbms_output.put_line('reverse of number is '||rev);
end;
/

output

Enter value for no: 1354
old   6: no:=&no;
new   6: no:=1354;
reverse of number is 4531