Need help with this Array Sorting challenge. I can't seem to solve it. Any help would be greatly appreciated. | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Need help with this Array Sorting challenge. I can't seem to solve it. Any help would be greatly appreciated.

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                      }     } }

13th Aug 2021, 7:28 AM
Cameron
2 Respuestas
+ 6
You need to add Array.Sort() method with for loop to complete the rest. Array.Sort(numbers); for (int i = 0; i < count; i++) { Console.WriteLine(numbers[i]); }
13th Aug 2021, 7:52 AM
Simba
Simba - avatar
+ 2
Thank you very much
13th Aug 2021, 7:58 AM
Cameron