Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06._Math_Puzzle
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int key = int.Parse(Console.ReadLine());
  10. for (int a = 1; a <= key; a++)
  11. {
  12. for (int b = 1; b <= key; b++)
  13. {
  14. for (int c = 1; c <= key; c++)
  15. {
  16. if (a<b&&b<c&&a+b+c==key)
  17. {
  18. Console.WriteLine($"{a} + {b} + {c} = {key}");
  19. }
  20. if (a>b&&b>c&&a*b*c==key)
  21. {
  22. Console.WriteLine($"{a} * {b} * {c} = {key}");
  23. }
  24. }
  25. }
  26. }
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement