Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Loop_Combination
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int counter = 0;
- for (int x1 = 0; x1 <= n; x1++)
- {
- for (int x2 = x1; x2 <= n; x2++)
- {
- for (int x3 = x2; x3 <= n; x3++)
- {
- for (int x4 = x3; x4 <= n; x4++)
- {
- for (int x5 = x4; x5 <= n; x5++)
- {
- n = x1 + x2 + x3 + x4 + x5;
- counter++;
- }
- }
- }
- }
- }
- Console.WriteLine(counter);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment