static void Main(string[] args) { int[] num = new int[] { 20, 50, 10, 70, 40, 80, 30, 90, 60 }; int t = 0; for (int i = 0; i < num.Length; i++) { for (int j = i + 1; j < num.Length; j++) if (num[i] > num[j]) { t = num[i]; num[i] = num[j]; num[j] = t; } } Console.WriteLine("Sorting elements in Ascending Order :\n"); for (int i = 0; i < num.Length; i++) Console.WriteLine(num[i]); Console.ReadLine(); }