﻿ C# Sharp Exercises: LINQ : Accept the members of a list and display the members more than a specific value - w3resource

# C# Sharp Exercises: LINQ : Accept the members of a list and display the members more than a specific value

## C# Sharp LINQ : Exercise-10 with Solution

Write a program in C# Sharp to Accept the members of a list through the keyboard and display the members more than a specific value.

Sample Solution:-

C# Sharp Code:

``````using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class LinqExercise10
{
static void Main(string[] args)
{
int i=0;
int memlist,n,m;
List<int> templist = new List<int>();
Console.Write("\nLINQ : Accept the members of a list and display the members more than a specific value : ");
Console.Write("\n----------------------------------------------------------------------------------------\n");

Console.Write("Input the number of members on the List : ");

for(i=0;i<n;i++)
{
Console.Write("Member {0} : ",i);
}

Console.Write("\nInput the value above you want to display the members of the List : ");

List<int> FilterList = templist.FindAll(x => x > m ? true : false);
Console.WriteLine("\nThe numbers greater than {0} are : ",m);
foreach (var num in FilterList)
{
Console.WriteLine(num);
}

}
}
```
```

Sample Output:

```LINQ : Accept the members of a list and display the members more than a specific value :
----------------------------------------------------------------------------------------
Input the number of members on the List : 5
Member 0 : 10
Member 1 : 20
Member 2 : 30
Member 3 : 40
Member 4 : 50

Input the value above you want to display the members of the List : 20

The numbers greater than 20 are :
30
40
50
```

Flowchart:

C# Sharp Code Editor: