fork(6) download
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. System.out.print("Enter a positive number: ");
  6. Scanner scanner = new Scanner (System.in);
  7. int number = scanner.nextInt();
  8. int count;
  9. for (int i = 2; i<=(number); i++) {
  10. count=0;
  11. while (number % i == 0) {
  12. number /= i;
  13. count++;
  14. }
  15. if (count == 0) continue;
  16. System.out.println(i+ "**" + count);
  17. }
  18. }
  19. }
  20.  
  21.  
Success #stdin #stdout 0.05s 246080KB
stdin
15453
stdout
Enter a positive number: 3**2
17**1
101**1