Answer to Question #20141 in C# for kumar saurav

Question #20141
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]);
}
& }
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS