Perfect Number

Write a program to check perfect number using pl/sql

6 comments:

  1. --problem 3

    declare
    n number(5);
    i number(5);
    summ number(5):=0;
    rec number(5):=0;
    function check_perfect(n in out number)
    return number is
    begin
    while i<n loop
    if mod(n,i)=0 then
    summ:=summ+i;
    end if;
    end loop;
    return summ;
    end;

    begin
    dbms_output.put_line('Enter a number to check weather the number perfect or not:');
    n:=&n;
    rec:=check_perfect(n);
    if rec=n then
    dbms_output.put_line('Enter number is perfect');
    else
    dbms_output.put_line('Enter number is not perfect');
    end if;
    end;
    /

    ReplyDelete
  2. Id:201330499

    SQL> declare
    2 j number(10);
    3 n number(10);
    4 summ number(10):=0;
    5 begin
    6 j:=&number;
    7 for n in 1..j-1 loop
    8 if mod(j,n)=0 then
    9 summ:=summ+n;
    10 end if;
    11 end loop;
    12 if (summ=j) then
    13 dbms_output.put_line('This is perfect number');
    14 else
    15 dbms_output.put_line('This is not perfect number');
    16 end if;
    17 end;
    18 /
    Enter value for number: 28
    old 6: j:=&number;
    new 6: j:=28;
    This is perfect number

    ReplyDelete
  3. hi welcome to this blog.its really informative blog.thank you for sharing this blog.it will be really helpful to the c programming learners.once again thank you .
    c programming training

    ReplyDelete
  4. how to find perfect number using procedure

    ReplyDelete
  5. 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