0

HELP Static Classes

How to resolve this ? :X The program you are given takes the N number as the size of an array, followed by N numbers. Complete the program to sort and output every element of an array, each on a new line. Sample Input 4 1 14 3 5 Sample Output 1 3 5 14 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int count = Convert.ToInt32(Console.ReadLine()); int[] numbers = new int[count]; for (int i = 0; i < count; i++) { numbers[i] = Convert.ToInt32(Console.ReadLine()); } //your code goes here } } }

8th Oct 2021, 1:40 PM
Adam
2 Respuestas
0
You have defined array and simply taking inputs only for sorting you can use any techniques like merge sort insertion sort ..... or predefined method
8th Oct 2021, 1:58 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
0
Hello sir, this a great time to learn about sorting or using sets. For this problem, you can use a Java Set called SortedSet which will order the elements for you. Declare a new Instance and add the values of the array to the set. It will sort itself automatically
8th Oct 2021, 2:00 PM
Jibraeel Abdelwahhab
Jibraeel Abdelwahhab - avatar