a007.
判斷質數
| From: [122.124.82.217] |
發表日期
:
2011-11-02 02:48
import java.util.*;
import java.io.*;
public class isOnly{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
Solve sl = new Solve();---------------------------------->這裡的編譯器說這裡錯誤
long lint = 0;
while(sc.hasNext()){
lint = sc.nextLong();
sl.solve7(lint);
}
}
}
class Solve{
public void solve7(long l){
int count = 2;
while(( l%count) !=0 ){
count++;
}
if(count==l){
System.out.println("質數");
}else{
System.out.println("非質數");
}
}
}