Protected void FindMaxAndMinNumber()
{
var Numbers = new double[10];varMinimum = 0D;varMaximum = 0D;Numbers[0] = 4478.72;Numbers[1] = 67.97;Numbers[2] = 2.32;Numbers[3] = 13004.05;Numbers[4] = 0.44;Numbers[5] = 873846.08;Numbers[6] = 120.12;Numbers[7] = 479.23;Numbers[8] = 12.42;Numbers[9] = 873846.04;Minimum = Numbers[0];
for(var i = 0; i < Numbers.Length; i++){Console.WriteLine("Number {0,2}:{1, 10}", i + 1, Numbers[i]);}for (var i = 0; i < Numbers.Length; i++)
{
if(Minimum > Numbers[i])
Minimum = Numbers[i];
}
Console.WriteLine();
//Console.WriteLine("Minimum = {0}", Minimum);
label1.Text = "Minumum Number is" + Minimum;
for(int i = 0; i < Numbers.Length; i++)
{
if(Maximum < Numbers[i])
Maximum = Numbers[i];
}
}
No comments:
Post a Comment