Swap With Ref Method
mediumQuestion 458Write 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, so print one after the last line.
Hints3 available
Sign in to use hintsTopics
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.