Console.WriteLine("原数组为:");
foreach (var item in array )
{
Console.Write(item + "\t");
}
int[] newarray = new int[5];
for (int i=0;i<array.Length;i++)
{
if (array[4-i]<0)
{
newarray[i] = 0;
}
if(array[4-i]>0)
{
newarray[i] = array[4 - i];
}
} Console.WriteLine("\n"+"新数组为:");
foreach (var item in newarray )
{
Console.Write(item + "\t");
}
Console.ReadKey();