using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Collections;
namespace examples
{
class Program
{
static void Main(string[] args)
{
//The option I chose is to sort the array (Bubble sort) and return the integer in the first index.
int[] Arr = { 1, 10, -5, 10, 12,6,2,-9,0,4,2 };
for (int i= 0; i < Arr.Length; i++)
{
for (int j = i; j < Arr.Length; j++)
{
if (i == j)
{
}
else
{
if (Arr[i] <= Arr[j])
{
//break;
}
else
{
int temp = Arr[j];
Arr[j] = Arr[i];
Arr[i] = temp;
}
}
}
}
Console.WriteLine("The lowest value in the array is {0}", Arr[0]);
Console.ReadKey();
}
}
}
No comments:
Post a Comment