Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function primos(num){
- number = []
- if(num == 0 || num ==1){
- throw "o número deve ser maior que 2"
- } else{
- var i, j;
- for(i = 2; i < num; i++){
- count = 0;
- for(j = 2; j < i; j++){
- if(i%j ===0){
- count = count + 1
- }
- }
- if(count === 0){
- number.push(i)
- }
- }
- }
- return number
- }
Add Comment
Please, Sign In to add comment