Advertisement
bpavlov123bp

MagicCombination

Apr 4th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. using System;
  2.  
  3. namespace MagicCombination
  4. {
  5. class Program
  6. {
  7. public static void Main(string[] args)
  8. {
  9. int n = int.Parse(Console.ReadLine());
  10. int multiply = 0;
  11. for(int a = 1; a <= 9; a++)
  12. {
  13. for(int b = 1; b <= 9; b++)
  14. {
  15. for(int c = 1; c <= 9; c++)
  16. {
  17. for(int d = 1; d <= 9; d++)
  18. {
  19. for(int e = 1; e <= 9; e++)
  20. {
  21. for(int f = 1; f <= 9; f++)
  22. {
  23. multiply = a * b * c * d * e * f;
  24. if(multiply == n)
  25. {
  26. string sequence = "" + a + b + c + d + e + f;
  27. Console.Write("{0} ", sequence);
  28. }
  29. }
  30. }
  31. }
  32. }
  33. }
  34. }
  35. Console.WriteLine();
  36. Console.Write("Press any key to continue . . . ");
  37. Console.ReadKey(true);
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement