Hi, i need to make a program that reads in 10 numbers and then i have to get the lowest number, the highest number, the average and show all numbers below average. what i got so far is this :

double[] waarden = new double[10];

waarden = Convert.ToDouble(invoer);

for (int i = 0; i < waarden.Length; i++)

{waarden[i] = Convert.ToDouble(Console.ReadLine());

Console.WriteLine("this is the highest number till now" + Math.Max(?, ?));

Console.WriteLine("this is the lowest number till now" + Math.Min(i, i));}

for (int i = 0; i < waarden.Length; i++)

{

waarden[i] = Convert.ToDouble(Console.ReadLine());

}It shows the numbers i typed in but i cant get the highest and lowest cause it says i cant convert a double to double[] o.0

anyone can help?

thanks ;)

Ah np i think i found it ;) i used another for loop double maxwaarde = 0;

double minwaarde = 9999;

double opsomgetal = 0;

for (int i = 0; i < waarden.Length; i++)

{

if (waarden[i] > maxwaarde)

{

maxwaarde = waarden[i];

}

if (waarden[i] < minwaarde)

{

minwaarde = waarden[i];

}

opsomgetal += waarden[i];

Ask Your Question

Weekly Poll

Do you think Google Fiber has a strong future?

Discuss in The Lounge

Poll History