C# Program to Print Only Those Numbers Whose Value is Less Than Average of all Elements in an Integer Array using LINQ Last Updated : 18 Oct, 2021 Comments Improve Suggest changes Like Article Like Report Language-Integrated Query (LINQ) is a uniform query syntax in C# to retrieve data from different sources. It eliminates the mismatch between programming languages and databases and also provides a single querying interface for different types of data sources. In this article, we will learn how to print only those numbers whose value is less than the average of all elements in an integer array using LINQ in C#. Example: Input: 464, 23, 123, 456, 765, 345, 896, 13, 4 Output: Average is 343 So the numbers less than the average are: 23 123 13 4 Input: 264, 3, 223, 556, 1, 965, 145, 2, 14 Output: Average is 241 So the numbers less than the average are: 3 223 1 145 2 14 Approach: To print only those numbers whose value is less than average of all elements in an array we use the following approach: Store integer(input) in an array.The sum of the elements is calculated using the Sum() method.The average of the array is calculated by dividing the sum by the length of the array.By using the LINQ query we will store the numbers less than the average of the array in an iterator.Now the iterator is iterated and the integers are printed. Example: C# // C# program to display only those numbers whose value is // less than average of all elements in an array using LINQ using System; using System.Linq; class GFG{ static void Main() { // Storing integers in an array int[] Arr = { 464, 23, 123, 456, 765, 345, 896, 13, 4 }; // Find the sum of array int total = Arr.Sum(); // Find the average of array int avg = total / Arr.Length; // Store the numbers in an iterator var nums = from num in Arr where num < avg select num; // Display the result Console.WriteLine("Average is " + avg); Console.WriteLine("The Numbers:"); foreach(int n in nums) { Console.Write(n + " "); } Console.WriteLine(); } } Output: Average is 343 The Numbers: 23 123 13 4 Comment More infoAdvertise with us Next Article C# Program to Print Only Those Numbers Whose Value is Less Than Average of all Elements in an Integer Array using LINQ P pulamolusaimohan Follow Improve Article Tags : C# CSharp LINQ CSharp-programs Similar Reads C# Program to Print the Numbers Greater Than 786 in an Integer Array using LINQ Language-Integrated Query (LINQ) is a uniform query syntax in C# to retrieve data from different sources. It eliminates the mismatch between programming languages and databases and also provides a single querying interface for different types of data sources. In this article, we will learn how to di 2 min read C# Program to Print Employees Whose Salary is Greater than Average of all Employees Salaries Using LINQ LINQ is known as Language Integrated Query and it is introduced in .NET 3.5. It gives the ability to .NET languages to generate queries to retrieve data from the data source. It removes the mismatch between programming languages and databases and the syntax used to create a query is the same no matt 3 min read C# Program to Print the Employees Whose ID is Greater Than 101 Using LINQ LINQ is known as Language Integrated Query and it is introduced in .NET 3.5. It gives the ability to .NET languages to generate queries to retrieve data from the data source. It removes the mismatch between programming languages and databases and the syntax used to create a query is the same no matt 3 min read C# Program to Find Greatest Numbers in an Array using WHERE Clause LINQ LINQ is known as Language Integrated Query and it is introduced in .NET 3.5. It gives the ability to .NET languages to generate queries to retrieve data from the data source. It removes the mismatch between programming languages and databases and the syntax used to create a query is the same no matt 2 min read C# Program to Generate Numbers that are Multiples of 5 Using the LINQ Parallel Query LINQ is known as Language Integrated Query and it is introduced in .NET 3.5. It gives the ability to .NET languages to generate queries to retrieve data from the data source. It removes the mismatch between programming languages and databases and the syntax used to create a query is the same no matt 2 min read C# Program to Print the Employees Whose Salary is Between 6000 and 8000 Using LINQ LINQ is known as Language Integrated Query and it is introduced in .NET 3.5. It gives the ability to .NET languages to generate queries to retrieve data from the data source. It removes the mismatch between programming languages and databases and the syntax used to create a query is the same no matt 3 min read C# Program for Count Inversions in an array | Set 1 (Using Merge Sort) Inversion Count for an array indicates - how far (or close) the array is from being sorted. If the array is already sorted, then the inversion count is 0, but if the array is sorted in the reverse order, the inversion count is the maximum. Formally speaking, two elements a[i] and a[j] form an invers 6 min read Mean of given array after removal of K percent of smallest and largest array elements Given an array arr[] and an integer K, the task is to remove K % percent array elements from the smallest and largest array elements and calculate the mean of the remaining array. Examples: Input: arr[] = {6, 2, 7, 5, 1, 2, 0, 3, 10, 2, 5, 0, 5, 5, 0, 8, 7, 6, 8, 0}, K = 5Output: 4.00000Explanation: 6 min read C# Program to Generate Odd Numbers in Parallel using LINQ LINQ is known as Language Integrated Query and it is introduced in .NET 3.5. It gives the ability to .NET languages to generate queries to retrieve data from the data source. It removes the mismatch between programming languages and databases and the syntax used to create a query is the same no matt 2 min read Count the number of element present in the sequence in LINQ? In LINQ, you can count the total number of elements present in the given sequence by using the Count Method. This method returns the total number of elements present in the given sequence. This method can be overloaded in two different ways: Count<TSource>(): This method returns the total numb 3 min read Like