Advertisement
Aniket_Goku

palindrom sql

Sep 12th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PL/SQL 0.34 KB | None | 0 0
  1. /* plaindom number*/
  2. DECLARE
  3.     ans NUMBER;
  4.     no1 NUMBER :=2112;
  5.     no2 NUMBER ;
  6.     rev NUMBER :=0;
  7. BEGIN
  8.     DBMS_OUTPUT.put_line('no => ' || no1);
  9.     no2:=no1;
  10.     WHILE(no2>0) LOOP
  11.     ans:=MOD(no2,10);
  12.     rev:=(rev*10)+ans;
  13.     no2:=FLOOR(no2/10);
  14.     END LOOP;
  15.    
  16.     IF(rev=no1) THEN
  17.         DBMS_OUTPUT.put_line( rev|| ' is palindrom number');
  18.     END IF;
  19. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement