Write a function that swaps two numbers x and y. Example, if x=5 and y=20, then after the function is called the new values of x and y should be x=20 and y=5. Write the code.

9 Ansichten (letzte 30 Tage)
x=5 y=20

Antworten (1)

C.J. Harris
C.J. Harris am 30 Jun. 2014
[x,y] = deal(y,x)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by