palindrome
Mon Apr 22 2024 06:26:16 GMT+0000 (Coordinated Universal Time)
Saved by
@signup
create or replace procedure rev(n in out integer,rn in out integer,b in out boolean )
is
temp integer:=0;
di integer:=0;
begin
temp:=n;
while n !=0 loop
di:=n mod 10;
rn:=rn*10+di;
n:=trunc(n/10);
end loop;
if temp=rn then
b:=true;
else
b:=false;
end if;
end;
/
declare
a integer :=&a;
b integer:=0 ;
c integer:=0;
d integer:=0;
f boolean :=false;
begin
rev(a,d,f);
if f=true then
dbms_output.put_line('it is a palindrome');
else
dbms_output.put_line('it is not a palindrome');
end if;
end;
/
content_copyCOPY
Comments