How would I go about making a method that reverses the position of 4 variables? [closed]

I think OP is looking for this

 static void Main(string[] args)
    {
        int first = 111;
        int second = 222;
        int third = 333;
        int fourth = 444;
        Console.WriteLine("Numbers in normal order: {0},{1},{2},{3}", first, second, third, fourth);
        Reverse(ref first, ref second, ref third, ref fourth);
        Console.WriteLine("Numbers in inverse order: {0},{1},{2},{3}", first, second, third, fourth);

        Console.WriteLine("Press Enter To Exit");
        Console.ReadLine();
    }

    public static void Reverse(ref int first1, ref int second2, ref int third3, ref int fourth4)
    {

        int temp, temp1;
        temp = first1;
        first1 = fourth4;
        temp1 = second2;
        second2 = third3;
        third3 = temp1;
        fourth4 = temp;
}

Leave a Comment