using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Biggestvalueinarray
{
class Program
{
static void Main(string[] args)
{
int[] a={22,3,44,32,99,2100,222,443,533};
for (int i = 0; i < a.Length; i++)
{
int temp = 0;
for (int j = i + 1; j < a.Length; j++)
{
if (a[i] > a[j])
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
// Array.Sort(a);
Console.WriteLine(a[0]);
Console.WriteLine(a[a.Length -1]);
Console.Read();
}
}
}
No comments:
Post a Comment