Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class test
- {
- public static void main(String[] args)
- {
- prime_num(5);
- }
- public static void prime_num(int r)
- {
- int count=0;
- int i=0;
- for(i=r; 0<i; i--);
- {
- if(r%i==0)
- count++;
- }
- if(count==2)
- System.out.println(r+"은 소수 입니다");
- else
- System.out.println(r+"은 소수가 아닙니다");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement