Prime Number

1. Write a program to count the prime number from previously stored values in a column of a table using pl/sql

13 comments:

  1. declare
    i number;
    n number;
    begin
    i:=2;
    n:=&a;
    for i in 2..n/2 loop
    if mod(n,i) <> 0 then
    dbms_output.put_line(n||' is a prime number');
    else
    dbms_output.put_line(n||' is not a prime number');
    end if;
    end loop;
    end;
    /

    ReplyDelete
  2. declare
    nm number(3);
    begin
    nm := &p;
    for ij in 2..nm/2 loop
    if mod(nm,ij)<>0 then
    dbms_output.put_line(nm || 'is a prime number');
    else
    dbms_output.put_line(nm || 'is not a prime number');
    end if;
    end loop;
    end;

    ReplyDelete
  3. declare
    n number;
    i number;
    counter number;
    begin
    n:=&n;
    i:=1;
    counter:=0;
    for i in 1..n loop
    if mod(n,i)=0
    then counter:=counter+1;
    end if;
    end loop;
    if counter=2
    then dbms_output.put_line(n||' is a prime No.');
    else
    dbms_output.put_line(n||' is a not prime No.');
    end if;
    end;

    ReplyDelete
  4. Id:201330499

    declare
    n number(10);
    j number(10);
    temp number(10):=1;
    begin
    dbms_output.put_line('Enter your number: ');
    n:=&number_for_prime_check;
    for j in 2..n-1 loop
    if(n mod j)=0 then
    temp:=0;
    exit;
    end if;
    end loop;
    if(temp=1)then
    dbms_output.put_line('Prime number');
    else
    dbms_output.put_line('Not prime number');
    end if;
    end;
    /

    ReplyDelete
  5. ID : 201620195
    https://www.dropbox.com/s/ui5m6pmfrs0np98/02.sql?dl=0

    ReplyDelete
  6. Md Aminul Islam Tushar
    ID#201710063

    Link : https://drive.google.com/open?id=1Ex1OPl1Wac3F-o4T1SeaUUGLtBTrQ8SA

    ReplyDelete
  7. Name: Yeasmin Sultana
    ID#201710251
    Link: https://drive.google.com/open?id=1XomVt1lT1Zh6i-Pq_nZ3IpulAQ4g-4of

    ReplyDelete
  8. Name:Sumsunnahar Nawa
    ID:201710090
    https://drive.google.com/open?id=19-JkNAa9ulZN-xUBfcDJLfgocVD27lSz

    ReplyDelete
  9. Md Rakibul Hasan
    201720620
    https://www.dropbox.com/s/042ayo12fko09dl/hw2q2.pdf?dl=0

    ReplyDelete
  10. ID: 201710404
    https://drive.google.com/open?id=1i06NwZnvxOSDT7vaGIWj1yjVbYIhJ88P

    ReplyDelete
  11. id : 201710081
    name : Eusha Chowdhury
    https://drive.google.com/open?id=1vi5bMi6LwJPlGFnTJJGIOsenAWd-yM-i

    ReplyDelete
  12. abdul muzid sunny
    id 201720450
    https://drive.google.com/open?id=0B3Angu96BPQtNlZRVVR5cWZ2SGRGWlN2LUl1LUxQRVV0bkNB

    ReplyDelete
  13. count prime number from previously stored table value
    https://drive.google.com/open?id=1G0H_B41WqZ__03fj21vtO-kpBZJ8tnSx

    ReplyDelete

Popular Posts

Total Pageviews

Followers