编程题目语言不限:因式分解

来源:百度知道 编辑:UC知道 时间:2024/09/28 12:00:44
要求输入自然数n,将它进行因式分解,并输出所有方案,
样例:输入:20
输出:20=2*10
20=2*2*5
20=4*5

package number;

import java.util.Scanner;

public class no {

/**
* @param args
*/
public static void main(String[] args) {
System.out.print("input your data: ");
Scanner sc = new Scanner(System.in);
int no = sc.nextInt();
int a = 0;
for(int i = 2 ; i < no / i ; i ++) {
if(no % i == 0 ) {
System.out.println(no + "=" + i + "*" +(no/i));

}

}
}

}

这个代码不好,当因数还能分解时应该再回调这个方法,但不知道输出该怎么改```````

N=N/10*10
N=N/10*N/10*100
N=N/100*100