- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# program to check if all the values in a list that are greater than a given value
Let’s say you need to find the elements in the following list to be greater than 80.
int[] arr = new int[] {55, 100, 87, 45};
For that, loop until the array length. Here, res = 80 i.e. the given element.
for (int i = 0; i < arr.Length; i++) { if(arr[i]<res) { Console.WriteLine(arr[i]); } }
The following is the complete code −
Example
using System; namespace Demo { public class Program { public static void Main(string[] args) { int[] arr = new int[] { 55, 100, 87, 45 }; // given integer int res = 80; Console.WriteLine("Given Integer {0}: ", res); Console.WriteLine("Numbers larger than {0} = ", res); for (int i = 0; i < arr.Length; i++) { if (arr[i] > res) { Console.WriteLine(arr[i]); } } } } }
- Related Articles
- Python program to check if all the values in a list that are greater than a given value
- Program to check if all the values in a list that are greater than a given value in Python
- Python - Check if all the values in a list are less than a given value
- Delete all the nodes from the doubly linked list that are greater than a given value in C++
- How to check if a list element is greater than a certain value in R?
- Delete all the nodes from a doubly linked list that are smaller than a given value in C++
- Replace all values in an R data frame if they are greater than a certain value.
- Delete all the nodes from the list that are greater than x in C++
- Check which element in a masked array is greater than a given value
- Program to filter all values which are greater than x in an array
- How to check if the elements of a series object are Greater Than or Equal to scalar value?
- C++ Program to check if a given number is Lucky (all digits are different)
- How to get values greater than a specific value from an embedded list in MongoDB?
- Program to check sublist sum is strictly greater than the total sum of given list Python
- Check if any value in an R vector is greater than or less than a certain value.

Advertisements