Write a two-input, two-output function that swaps its two input arguments. For example:

   [q,r] = swap(5,10)

returns q = 10 and r = 5.

Solution Stats

34921 Solutions

13645 Solvers

Last Solution submitted on May 20, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers13645

Suggested Problems

More from this Author6

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!