You are viewing a single comment's thread. Return to all comments →
Oracle pl/sql
SET SERVEROUTPUT ON; DECLARE RESULT VARCHAR2(2001) := ''; PRIM BOOLEAN := TRUE; BEGIN FOR I IN 2.. 1000 LOOP PRIM := TRUE; FOR J IN 2..FLOOR(sqrt(I)) LOOP if mod(i, j) = 0 then PRIM := FALSE; EXIT; end if; END LOOP; IF PRIM THEN RESULT := RESULT || I || '&' ; END IF; END LOOP; DBMS_OUTPUT.PUT_LINE(substr(RESULT,1,length(RESULT)-1)); END; /
Seems like cookies are disabled on this browser, please enable them to open this website
Print Prime Numbers
You are viewing a single comment's thread. Return to all comments →
Oracle pl/sql