Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Combinations
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.             int combinations = 0;
  11.             for (int i = 0; i <= n; i++)
  12.             {
  13.  
  14.                 for (int j = 0; j <= n; j++)
  15.                 {
  16.  
  17.                     for (int k = 0; k <= n; k++)
  18.                     {
  19.                         for (int f = 0; f <= n; f++)
  20.                         {
  21.                             for (int l = 0; l <= n; l++)
  22.                             {
  23.  
  24.                                 if (i + j + k + f + l == n)
  25.                                 {
  26.                                     combinations++;
  27.                                     Console.WriteLine($"{(combinations)}");
  28.                                     break;
  29.  
  30.  
  31.                                 }
  32.  
  33.  
  34.                             }
  35.                         }
  36.                     }
  37.  
  38.                 }
  39.  
  40.             }
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement