Aim - PL/SQL Program to accept a number from user and print number in reverse order.
Program: -declare num1 number(5); num2 number(5); rev number(5); begin num1:=&num1; rev:=0; while num1>0 loop num2:=num1 mod 10; rev:=num2+(rev*10); num1:=floor(num1/10); end loop; dbms_output.put_line('Reverse number is: '||rev); end;
Output: -
Enter value for num1: 12345
old 8: num1:=&num1;
new 8: num1:=12345;
Reverse number is: 54321
Dont SPAM