close
質因數分解...(說不定哪天會用到XD)
import java.util.*;
public class test11
{
public static void main(String[] args)
{
int a, aNew, t;
String pN = "1";
System.out.println("請輸入一個數");
Scanner x = new Scanner(System.in);
t = aNew = x.nextInt();
for(a = 2; a <= aNew; a++)
{
if(t%a == 0)
{
t = t/a;
pN = pN+"*"+a;
a=1;
}
}
System.out.println(pN + "="+aNew);
}
}
全站熱搜
留言列表