desislava777

sbor

Oct 31st, 2017
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 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. namespace ConsoleApplication18
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. bool bul= false;
  15. for (int a = 1; a <= 30; a++)
  16. {
  17. for (int b = 1; b <= 30; b++)
  18. {
  19. for (int c = 1; c <= 30; c++)
  20. {
  21. if (a < b && b < c && a + b + c == n)
  22. {
  23. bul = true;
  24. Console.WriteLine($"{a} + {b} + {c} = {n}");
  25. }
  26.  
  27. else if (a > b && b > c && a * b * c == n)
  28. {
  29. bul = true;
  30. Console.WriteLine($"{a} * {b} * {c} = {n}");
  31. }
  32. }
  33. }
  34. }
  35. if (bul == false)
  36. Console.WriteLine("No!");
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment