In this PL/SQL program i use nested table to store the digits and then print them in reverse order
declare
type arr_num is table of number;
temp_arr_num arr_num:=arr_num();
num number := &Enter_Number;
i number :=1;
begin
-- temp_arr_num.extend(6);
while(num >0)
loop
temp_arr_num.extend(1);
temp_arr_num(i) := mod(num,10);
num := floor(num/10);
i :=i+1;
end loop;
for i in reverse 1..temp_arr_num.count
loop
dbms_output.put_line(temp_arr_num(i));
end loop;
end;
No comments:
Post a Comment