DECLARE
len number;
palstr varchar2(20) := '&palstr';
chkstr varchar2(20);
BEGIN
len := length(palstr);
for i in REVERSE 1..len loop
chkstr := chkstr||substr(palstr,i,1);
end loop;
if chkstr = palstr then
dbms_output.put_line(palstr||' is a PALINDROME');
else
dbms_output.put_line(palstr||' is not a PALINDROME');
end if;
END;
len number;
palstr varchar2(20) := '&palstr';
chkstr varchar2(20);
BEGIN
len := length(palstr);
for i in REVERSE 1..len loop
chkstr := chkstr||substr(palstr,i,1);
end loop;
if chkstr = palstr then
dbms_output.put_line(palstr||' is a PALINDROME');
else
dbms_output.put_line(palstr||' is not a PALINDROME');
end if;
END;
No comments:
Post a Comment