Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

find minimum value in random number array?

$
0
0
Hey

This is my code for my array,the array works and fills it with 10 random numbers but i am having great difficulty trying to find the minimum value in the array.

My array code is
Random random = new Random();

            int[] numbers = new int[10];

            for (int i = 1; i < numbers.Length; i++)
            {
                numbers[i] = random.Next(1, 19);

                Console.WriteLine(numbers[i]);
            }




I have tried various methods and none seen to work. I am struggling to understand why this particular method doesn't work.

int min = numbers.Min();


Any help would be greatly appreciated.

Viewing all articles
Browse latest Browse all 51036

Trending Articles