Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace HomeWork
- {
- using System;
- using System.Linq;
- class Task_1
- {
- static void Main(string[] args)
- {
- bool isExitLoop = false;
- int n = 0;
- while (!isExitLoop)
- {
- n = int.Parse(Console.ReadLine());
- if (n >= 13 && n <= 25)
- {
- isExitLoop = true;
- }
- }
- int[] arr = CreateArray(n);
- int[] sortedArray = arr.OrderByDescending(x => x).ToArray();
- Console.WriteLine(String.Join(" ", sortedArray));
- }
- static int[] CreateArray(int n)
- {
- int[] result = new int[n];
- for (int i = 0; i < result.Length; i++)
- {
- result[i] = int.Parse(Console.ReadLine());
- }
- return result;
- }
- static int MaxElement(int[] arr)
- {
- int max = int.MinValue;
- for (int i = 0; i < arr.Length; i++)
- {
- if (arr[i] > max)
- {
- max = arr[i];
- }
- }
- return max;
- }
- static void PrintHiglessElements(int x, int[] arr)
- {
- for (int i = 0; i < arr.Length; i++)
- {
- if (arr[i] > x)
- {
- Console.WriteLine(arr[i]);
- }
- }
- }
- static void Comb()
- {
- int n = int.Parse(Console.ReadLine());
- int k = int.Parse(Console.ReadLine());
- int[] arr = new int[n];
- int[] combinations = new int[k];
- for (int i = 0; i < n; i++)
- {
- arr[i] = i + 1;
- }
- Combinations(0, 0, arr, combinations);
- static void Combinations(int index, int elementsStartIndex, int[] elements, int[] combinations)
- {
- if (index >= combinations.Length)
- {
- foreach (int item in combinations)
- {
- Console.Write($"{item} ");
- }
- Console.WriteLine();
- }
- else
- {
- for (int i = elementsStartIndex; i < elements.Length; i++)
- {
- combinations[index] = elements[i];
- Combinations(index + 1, i + 1, elements, combinations);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement