int[] a = new int[] { -20, 10, 8, 95, 62, 4, 3, 84, 600, 48, 900, 7, 12 }; int[] b = new int[10]; int intTemp = a[0]; int intMaxNum; for (int i = 0; i < a.Length; i++) { intTemp = a[i] > intTemp ? a[i] : intTemp; } intMaxNum = intTemp;//max number for (int j = 0; j < b.Length; j++) { for (int i = 0; i < a.Length; i++) { if (j == 0) intTemp = a[i] < intTemp ? a[i] : intTemp; else { if (a[i] > b[j - 1]) intTemp = a[i] < intTemp ? a[i] : intTemp; } } b[j] = intTemp; intTemp = intMaxNum; } foreach (int num in b) { Console.Write("{0} ", num); }