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;

2 comments:

  1. 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;

    ReplyDelete
  2. I really appreciate the information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in #TABLEAU, kindly Contact MaxMunus
    MaxMunus Offer World Class Virtual Instructor-led training on #TABLEAU. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 1,00,000 + training in India, USA, UK, Australia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain, and UAE etc.
    Avishek Priyadarshi
    MaxMunus
    E-mail: avishek@maxmunus.com
    Skype id: avishek_2.
    Ph:(0) 8553177744 / 080 - 41103383
    www.MaxMunus.com

    ReplyDelete

Popular Posts