Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6.  
  7. // read input number (which will be between 2 and 1000)
  8. int number = Integer.parseInt(sc.nextLine());
  9.  
  10. // factor the number into an array of prime factors
  11. int[] factors = factorize(number);
  12.  
  13. // print array of factors
  14. for (int i = 0; i < factors.length; i++) {
  15. System.out.print(factors[i]);
  16. if (i != factors.length - 1) {
  17. System.out.print(" ");
  18. }
  19. }
  20. System.out.println();
  21. }
  22.  
  23.  
  24. public static int[] factorize(int number) {
  25. // TODO implement this
  26. //throw new UnsupportedOperationException();
  27.  
  28. }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement