Numbers Greater than 500 : 4443 1008 6000 767
Users Online
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
Forum Threads
Latest Articles
Articles Hierarchy
C# Program to Display the Greatest Numbers in an Array using WHERE Clause LINQ
C# Program to Display the Greatest Numbers in an Array using WHERE Clause LINQ
This is a C# Program to display the greatest numbers in an array using where clause linq.
This C# Program Displays the Greatest numbers in an Array using WHERE Clause LINQ.
Here the where clause is used in a query expression to specify which elements from the data source will be returned in the query expression
Here is source code of the C# Program to Display the Greatest numbers in an Array using WHERE Clause LINQ. The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.
/* * C# Program to Display the Greatest numbers in an Array using WHERE Clause LINQ */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main() { int[] numbers = { 500, 344, 221, 4443, 229, 1008, 6000, 767, 256, 0 }; var greaterNums = from num in numbers where num > 500 select num; Console.WriteLine("Numbers Greater than 500 :"); foreach (var s in greaterNums) { Console.Write(s.ToString() + " "); } Console.Read(); } }
This C# program is used to print the greatest numbers in an array using WHERE clause LINQ. We have already defined the values of ‘array[]’ variable. The where clause is used in a query expression to specify which elements from the data source will be returned in the query expression. The foreach() function is used to print the element values greater than 50.