palindrome_procedure

PHOTO EMBED

Sun May 26 2024 17:32:27 GMT+0000 (Coordinated Universal Time)

Saved by @signup

create or replace procedure palind(ran in out integer,res in out integer)
Is
  num1 integer:=0;
  
   i integer;
 su integer:=ran;
begin 
   while (ran>0)
 loop
    i:=mod(ran,10);
    num1:=num1*10+i;
   ran:=trunc(ran/10); 
    end loop;
 if (su=num1) then
    res:=1;
else
   res:=0;
end if;
end;
/
declare 
  a integer:=&a;
  b integer:=0;
begin 
  palind(a,b);
   if (b=1) then 
   dbms_output.put_line(' Palindrome');
   else 
  dbms_output.put_line('Not Palindrome');
  end if;
end;
/
  
content_copyCOPY