Exemple #1
0
        // Exercise 2
        public static int GreaterCount(List<double> temperatures, double min)
        {
            Console.WriteLine("\n Exercise 2 Output :- ");
            int count = 0;
            foreach (double content in temperatures)
            {

                if (content > min)
                    count++;
            }

            return count;
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            List<double> temperatures = new List<double>();

            temperatures.Add(24.7);
            temperatures.Add(5.7);
            temperatures.Add(70.0);
            temperatures.Add(25.2);
            temperatures.Add(55.2);

            //Console.WriteLine("\n No of count Which is Greater than 25 degree:- " + GreaterCount(temperatures,25));

            Console.WriteLine(" No of count Which is Greater than or equle to 25 degree:- " + GreaterCount((IEnumerable<double>)temperatures, 25));
            Console.ReadLine();
        }