Advertisement
TeMePyT

Untitled

Apr 28th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7.  
  8. class Program
  9. {
  10. static void Main()
  11. {
  12. int n = int.Parse(Console.ReadLine());
  13. bool isFound = false;
  14. for (int a = 1; a <= 9; a++)
  15. {
  16. for (int b = 9; b >= a; b--)
  17. {
  18. for (int c = 0; c <= 9; c++)
  19. {
  20. for (int d = 9; d >= c; d--)
  21. {
  22. if ((a + b + c + d) == (a * b * c * d) && (n % 10 == 5))
  23. {
  24. Console.WriteLine(a * 1000 + b * 100 + c * 10 + d);
  25. isFound = true;
  26. return;
  27. }
  28. else if (((a * b * c * d) / (a + b + c + d) == 3) && (n % 3 == 0))
  29. {
  30. Console.WriteLine((d * 1000 + c * 100 + b * 10 + a));
  31. isFound = true;
  32. return;
  33. }
  34. }
  35. }
  36. }
  37. }
  38. if (isFound)
  39. {
  40. Console.WriteLine();
  41. }
  42. else
  43. {
  44. Console.WriteLine("Nothing found");
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement