?? getprime.java
字號:
import java.io.*;
public class GetPrime {
public static void main ( String args[ ]){
int a = 0;
String s;
try{
System.out.print("請輸入一個自然數:");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
s = br.readLine();
a = Integer.parseInt(s);
}catch(IOException e){}
System.out.println("素數因子為:");
loop: for(int i=1; i<=a; i++){
for(int j=2;j<=Math.sqrt(i);j++)
if(i%j==0) continue loop;
if(a%i==0){
System.out.print(i+"\t");
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -