Advertisement
Guest User

Untitled

a guest
Jul 18th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace _06.Combination
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10.  
  11. int n = int.Parse(Console.ReadLine());
  12.  
  13. int counter = 0;
  14.  
  15. for (int a = 0; a <= n; a++)
  16. {
  17. for (int b = 0; b <= n; b++)
  18. {
  19. for (int c = 0; c <= n; c++)
  20. {
  21. for (int d = 0; d <=n; d++)
  22. {
  23. for (int e = 0; e <= n; e++)
  24. {
  25. if(a+b+c+d+e==n)
  26. {
  27. counter++;
  28. }
  29. }
  30. }
  31. }
  32. }
  33. }
  34.  
  35. Console.WriteLine(counter);
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement