galinyotsev123

ProgBasics07Nested-Loops-P09magicNumbers*

Jan 7th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P09magicNumbers* {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. long n = Long.parseLong(scanner.nextLine());
  8.  
  9. for (int i = 1; i <= 9; i++) {
  10. for (int j = 1; j <= 9; j++) {
  11. for (int k = 1; k <= 9; k++) {
  12. for (int l = 1; l <= 9; l++) {
  13. for (int m = 1; m <= 9; m++) {
  14. for (int o = 1; o <= 9; o++) {
  15.  
  16. long result = i * j * k * l * m * o;
  17.  
  18. if (result == n) {
  19. System.out.printf("%d%d%d%d%d%d ", i, j, k, l, m, o);
  20. }
  21. }
  22. }
  23. }
  24. }
  25. }
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment