narenarya

Julia prime no generator

May 5th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function isprime(x::Int)
  2.             temp::Int=0;
  3.             for i=1:x
  4.                 if x%i==0
  5.                     temp+=1
  6.             end
  7. end
  8. temp==2?true:false
  9. end
  10.  
  11. println("primes upto 100")
  12. for i=1:100
  13.         if isprime(i)
  14.                 print(i,' ')
  15.         end
  16. end
Advertisement
Add Comment
Please, Sign In to add comment