write a program to display the highest 10 number entered.
1
Expert's answer
2012-12-06T11:48:11-0500
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace ConsoleApplication1 { class Program { & static void Main(string[] args) & { List<int> ar = new List<int>(); Console.WriteLine("Enter array length:"); int len = int.Parse(Console.ReadLine()); for (int i = 0; i < len; i++) { ar.Add(int.Parse(Console.ReadLine())); } ar.Sort(); for (int i = 0; i < 10 && i < len; i++) { Console.WriteLine(ar[i]); } & } } }
Comments
Leave a comment