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.

19 visualizaciones (últimos 30 días)
x=5 y=20

Respuestas (1)

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

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by