Answer to Question #343899 in C# for Jen

Question #343899

Write a program in C# Sharp to show how the three parts of a query


operation execute.


Expected Output:


The numbers which produce the remainder 0 after divided by 2 are :


0 2 4 6 8

1
Expert's answer
2022-05-24T13:58:33-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>() { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };


            IEnumerable<int> filteringQuery =
                from num in list
                where (num % 2) == 0
                select num;


            Console.WriteLine("The numbers which produce the remainder 0 after divided by 2 are:");
            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