Find a Nth highest or lowest numbers in a given series of Doubles using C#

Rajnilari2015
Posted by Rajnilari2015 under C# category on | Points: 40 | Views : 181
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication2

{
class Program

{
static void Main(string[] args)

{

List<double> lstNumbers= new List<double>() { 1, 2.06, 34, -4, 5.90, 61.9, 7.8, 8, 9, 18.0,23.7 };



double minNum = lstNumbers.Min(); //lowest number

double maxNum = lstNumbers.Max(); //highest number



Console.WriteLine("Min = {0} , Max = {1}", minNum, maxNum);



Console.ReadKey(true);

}

}

}


/*
Min = -4 , Max = 61.9
*/

Comments or Responses

Login to post response