C# Program to Generate Numbers that are Multiples of 5 Using the LINQ Parallel Query Last Updated : 01 Nov, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 matter which type of data source is used. In this article, we are going to generate the numbers from the given range which are multiples of 5 parallelly. So to do our task we are using the inbuilt ParallelQuery class to generate numbers in parallel. Syntax: ((ParallelQuery<int>)ParallelEnumerable.Range(start, stop)) Where start is the starting number and stop is the ending number. Example: Input : Range(3, 20) Output : 10 15 20 5 Input : Range(1,10) Output : 5 10Example: In the below example, first, we will create a number collection of IEnumerable types range from 3 to 20 then generate numbers that are multiples of 5 present in between the given range using Where(n => n% 5 == 0) function. After generating numbers that are multiples of 5 we will display these numbers on the output screen. C# // C# program to generate numbers that // are multiples of 5 using System; using System.Collections.Generic; using System.Linq; class GFG{ static void Main(string[] args) { // Input numbers from 3 to 20 // Using ParallelQuery IEnumerable<int> result = ((ParallelQuery<int>)ParallelEnumerable.Range(3, 20)) // Generate numbers that are multiples // of 5 in parallel .Where(n => n % 5 == 0).Select(res => res); // Display the numbers which are multiples of 5 Console.WriteLine("Numbers are:"); foreach (int numbers in result) { Console.WriteLine(numbers); } } } Output: Numbers are: 10 15 20 5 Comment More infoAdvertise with us Next Article C# Program to Print the Employees Whose Name Contains Less Than 4 Characters Using LINQ M manojkumarreddymallidi Follow Improve Article Tags : C# CSharp LINQ CSharp-programs Similar Reads 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 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 Only Those Numbers Whose Value is Less Than Average of all Elements 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 pr 2 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 Print the Employees Whose Name Contains Less Than 4 Characters 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 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 Like