CJCoding With Joseph
15free / daySign inCreate account

Swap With Ref Method

Write the void static method Swap using two ref int parameters so it exchanges the values of the two variables passed to it. The tester swaps x and y, then prints them separated by a space. Do NOT write a Main method.

Starting from x = 3 and y = 8, after Swap(ref x, ref y) the program prints exactly the output shown in Expected Output.

Expected Output:

8 3

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
Methods
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.