Error in reverse arrangement

0

I made an arrangement of 10 elements, and then another arrangement with the same amount of the 1st but the content is inverse, example:

List 1: 1. 20 2. 34 3. 12 List 2: 10. 20 9. 34 8. 12

And so ...

static void Main(string[] args)
    {
        int [] lista1 = new int [10];
        int [] lista2 = new int [10];
        generarListas(lista1, lista2);
        Console.ReadKey();
    }

    static void generarListas(int[] lista1, int[] lista2)
    {
        Random random = new Random();
        for (int i = 1; i <= lista1.GetLength(0); i++)
        {
            lista1[i-1] = random.Next(1, 50);
            Console.WriteLine("N " +i+ " - " +(lista1[i-1]));

        }
        for (int n = 1; n <= lista2.GetLength(0); n++)
        {
            lista2[lista2.GetLength(0) - n] = lista1[n - 1];
            Console.WriteLine("N " +n+ " - " +(lista2[n - 1]));
        }
    }

But this appears to me:

    
asked by Churri 13.02.2018 в 07:25
source

0 answers