galinyotsev123

ProgBasicsJavaBook7.2ComplexLoop02magicCombination

Jan 11th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class E02magicCombination {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int magic = Integer.parseInt(scanner.nextLine());
  8.  
  9. for (int d1 = 0; d1 <= 9; d1++) {
  10. for (int d2 = 0; d2 <= 9; d2++) {
  11. for (int d3 = 0; d3 <= 9; d3++) {
  12. for (int d4 = 0; d4 <= 9; d4++) {
  13. for (int d5 = 0; d5 <= 9; d5++) {
  14. for (int d6 = 0; d6 <= 9; d6++) {
  15.  
  16. if ( d1 * d2 * d3 * d4 * d5 * d6 == magic){
  17. System.out.print(String.format("%d%d%d%d%d%d ", d1, d2, d3, d4, d5, d6));
  18. }
  19.  
  20.  
  21.  
  22. }
  23. }
  24. }
  25. }
  26. }
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment