import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int a=sc.nextInt(); int b=sc.nextInt(); for (int i = a; i <=b; i++) { int n=i;int count=0;//首次打印 boolean isPri=true;//判断是不是质数 System.out.print(n+"="); for(int j=2;j*j<=n;j++) { //因子都被拆分了 都是质因子 if(i%j==0) isPri=false; while(n%j==0){ n=n/j; if(count==0){ count++; System.out.print(j); } else System.out.print("*"+j); } } if(n>1){ if(isPri)System.out.print(n); else System.out.print("*"+n); } System.out.println(); } } }
0.0分
0 人评分
三进制小数 (C语言代码)浏览:1025 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)浏览:474 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:728 |
C语言程序设计教程(第三版)课后习题10.1 (C语言代码)浏览:1447 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:653 |
大神老白 (C语言代码)浏览:611 |
Hello, world! (C语言代码)浏览:1201 |
用筛法求之N内的素数。 (C语言代码)浏览:1254 |
C语言程序设计教程(第三版)课后习题6.5 (C语言代码)浏览:758 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:702 |