Created
September 25, 2014 15:13
-
-
Save NekoTashi/596bd2692ce2ac8e2ef6 to your computer and use it in GitHub Desktop.
PL SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
i number(3); | |
j number(3); | |
function es_primo(p int) return boolean | |
is | |
BEGIN | |
FOR k in reverse 2..(p-1) LOOP | |
IF mod(p, k) = 0 THEN | |
RETURN false; | |
END IF; | |
END LOOP; | |
RETURN true; | |
END; | |
BEGIN | |
i:=2; | |
LOOP | |
IF ES_PRIMO(i) then | |
dbms_output.put_line(i||' es primo'); | |
END IF; | |
exit when i=50; | |
I:= I+1; | |
END LOOP; | |
END; | |
/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment