Showing posts with label mod. Show all posts
Showing posts with label mod. Show all posts

Strange Number

Write a program to check whether a given number is strange or not using pl/sql.


declare
digit number;
temp number;
rem number;
i number;
j number;
begin
digit:=&d;
while digit!=0 loop
j:=digit/10;
rem:=mod(digit,10);
digit:=j;
for i in 2..rem-1 loop
if mod(rem,i) <> 0 then
temp:=0;
exit;
end if;
end loop;
end loop;
if temp <> 1 then
dbms_output.put_line('strange number');
else
dbms_output.put_line(' not strange number');
end if;
end;

Popular Posts