Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1.  
  2. class test
  3. {
  4. public static void main(String[] args)
  5. {
  6.  
  7. prime_num(5);
  8. }
  9.  
  10. public static void prime_num(int r)
  11. {
  12. int count=0;
  13. int i=0;
  14.  
  15. for(i=r; 0<i; i--);
  16. {
  17. if(r%i==0)
  18. count++;
  19. }
  20.  
  21. if(count==2)
  22. System.out.println(r+"은 소수 입니다");
  23. else
  24. System.out.println(r+"은 소수가 아닙니다");
  25.  
  26. }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement