Answer to Question #343900 in C# for Jen

Question #343900

Write a program in C# Sharp to find the positive numbers from a list of



numbers using two where conditions in LINQ Query.



Expected Output:



The numbers within the range of 1 to 11 are :



1 3 6 9 10

1
Expert's answer
2022-05-23T15:17:38-0400
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp1
{
  class Program
  {
    static void Main(string[] args)
    {
      List<int> list = new List<int>() { 1, 3, 6, 9, 10,0, -1, -3, -6, -9, -10 };
      IEnumerable<int> filteringQuery =
        from num in list
        where num >= 1 && num <= 11
        select num;
      foreach(int i in filteringQuery)
        Console.Write(i+" ");
    }
  }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS