Please help me with the task: Swap the values.

Hello, I’m working on this task:

  1. Write a program that swaps the values of two int variables x and y, using a third variable to temporarily hold one value. Initial values for x and y are already given. The output of the program should be “x is {x} and y is {y}” after you swap the values. Use string interpolation.

Here is my code:


class SwapTheValues
{
   static void Main()
   {
       int x = 10;
       int y = 20;
       int temp = x;
       x = y;
       y = temp;

       Console.WriteLine($"x is {{x}},y is {{y}}");

   }
}

Can anyone please help me to solve it?