Print Prime Numbers Hackerrank Solution - PL/SQL

 Print Prime Numbers Hackerrank Solution - PL/SQL


For Explanation watch video:



Code::

set serveroutput on;
declare
output clob := '';
co number;
begin
 for i in 2..1000 loop
     co := 0;
     for j in 2..(i/2) loop
       if mod(i,j)=0
         then
           co := 1;
           exit;
        end if;
    end loop;
    if co = 0
     then
       output :=  output || i ||'&';
    end if;
    end loop;
    dbms_output.put_line(substr(output,1,length(output)-1));
end;
/

Comments

Popular posts from this blog

how to store html form data in mysql database using hibernate