I need to find the minimum of 5 integer values. i have used if else statement to compare. So its not looking good. i.e. code is very lengthy. I dont know how to reduce the code complexity. can anyone help me out?
Regards, Karthi
Use Python's min() and max() to find smallest and largest values in your data.
You can use Min
method from LINQ:
var list = new[] {1, 2, 3, 4, 5};
int min = list.Min();
Here is the list of LINQ Min
you can refer:
http://msdn.microsoft.com/en-us/library/system.linq.enumerable.min.aspx
Check out the Min method of LINQ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With