MilenaPetkanova

0212_PasteNumbers

Sep 23rd, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _0212_TestNumbers
  4. {
  5. class TestNumbers
  6. {
  7. static void Main(string[] args)
  8. {
  9. int n = int.Parse(Console.ReadLine());
  10. int m = int.Parse(Console.ReadLine());
  11. int sumBoundary = int.Parse(Console.ReadLine());
  12.  
  13. int sum = 0;
  14. int counter = 0;
  15.  
  16. for (int i = n; i >= 1; i--)
  17. {
  18. for (int j = 1; j <= m; j++)
  19. {
  20. sum += i * j * 3;
  21. counter++;
  22. }
  23. }
  24.  
  25. if (sum >= sumBoundary)
  26. {
  27. Console.WriteLine($"{counter} combinations");
  28. Console.WriteLine($"Sum: {sum} >= {sumBoundary}");
  29. }
  30. else
  31. {
  32. Console.WriteLine($"{counter} combinations");
  33. Console.WriteLine($"Sum: {sum}");
  34. }
  35. }
  36. }
  37. }
Add Comment
Please, Sign In to add comment