Why in gods name wasnt mine accepted? Its the same one as the " Code easy will solve this "

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} and y is {y}");

Its solved I just need help understanding why my code didnt work.

This code looks good to me and it is accepted by CodeEasy. What code didn’t work, can you please clarify?