标签:style blog color ar java sp div c log
package com.hpu.bai; /** * 此程序用来把一个正整数分解成质因数相乘 如 20 = 2*2*5; * @author bai * */ public class Byprime { public static int prime(int m){ int k =2;int count =0; System.out.print(m+"="); while(k<=m){ if(k == m){ System.out.print(m); count+=1; break; }else if(m%k ==0){ System.out.print(k+"*"); count+=1; m = m/k; }else{ k++; } } return count; } public static void main(String[] args) { int count = prime(29); if(count ==1 ){ System.out.println("这是一个素数"); }else System.out.println("这是一个合数"); } } 交流QQ623687677 java 初学者
标签:style blog color ar java sp div c log
原文地址:http://www.cnblogs.com/neruda/p/3996558.html