using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp8
{
internal class Program
{
static void Main(string[] args)
{
try
{
int[] array = new int[9];
int i, j, temp;
Console.Write("请输入n值(n<10):");
int x = Convert.ToInt32(Console.ReadLine());
if(x>=10)
{
Console.WriteLine("你输入的n的值必须小于10!");
Console.ReadLine();
}
Console.Write("生成的数组为:");
for (i = 0; i < x; i++)
{
array[i] = Convert.ToInt32(Console.ReadLine());
}
for (i = 0, j = x - 1; i < j; i++, j--)
{
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
Console.Write("逆序后的数组为:");
for (i = 0; i < x; i++)
{
Console.Write(array[i] + " ");
Console.ReadLine();
}
}
catch
{
Console.WriteLine("请使用数字来输入n的值!");
Console.ReadLine();
}
}
}
}
12-05
835