Tech Study

Write a program in C# to find the positive numbers from a list of numbers using two where conditions in LINQ Query

Introduction

I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.

using System;
using System.Linq;
 
class LinqExercise
{
    static void Main()
    {
        int[] numbers = {  
                1, 3, 6, 9, 10, -4, -2, -3, -88, 12, 19,  14  
            };
 
        var nQuery =
        from VrNum in numbers
        where VrNum > 0
        where VrNum < 10
        select VrNum;
        Console.Write("\nThe numbers within the range of 1 to 10 are : \n");
        foreach (var VrNum in nQuery)
        {
            Console.Write("{0}  ", VrNum);
        }
        Console.ReadLine();
    }
}

Result

Write a program in C# to find the positive numbers from a list of numbers using two where conditions in LINQ Query
Write a program in C# to find the positive numbers from a list of numbers using two where conditions in LINQ Query

TaggedWrite a program in C# to find the positive numbers from a list of numbers using two where conditions in LINQ Query

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more