Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 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 Combination
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.             int counter = 0;
  15.             for (int i = 0; i <= n; i++)
  16.             {
  17.                 for (int j = 0; j <= n-i; j++)
  18.                 {
  19.                     for (int k = 0; k <= n-j-i; k++)
  20.                     {
  21.                         for (int l = 0; l <= n-k-j-i; l++)
  22.                         {
  23.                             for (int m = 0; m <= n-l-k-j-i; m++)
  24.                             {
  25.                                 if (i + j + k + l + m == n)
  26.                                 {
  27.                                     counter++;
  28.                                 }
  29.                             }
  30.                         }
  31.                     }
  32.                 }
  33.             }
  34.             Console.WriteLine(counter);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement