using System; namespace Test { class Program { static void Main() { int[] a = { -9, 4, 6, -3, -4, 7, 2, 6, 3, -7 }; int index = -1; for(int i = 0; i < a.Length; i++) { if(a[i] > 0) { index = i; break; } } if(index != -1) { for(int i = 0; i < a.Length; i++) { Console.Write(a[i] + " "); if(a[i] > 0 && a[index] > a[i]) { index = i; } } } else return; Console.WriteLine(); a[index] = a[a.Length - 1]; for(int i = 0; i < a.Length; i++) { Console.Write(a[i] + " "); } Console.WriteLine(); } } }