code in script called swap

write a few lines of code that swap the values of x and y. Put your code in a script called swap and test it.

4 件のコメント

James Tursa
James Tursa 2020 年 1 月 24 日
What have you done so far? What specific problems are you having with your code?
Jose Morales
Jose Morales 2020 年 1 月 24 日
I just have the script
>> swap
If it works properly it should work like this:
>> x = 1, y = 2
x = 1
y = 2
>> swap
>> x, y
x = 2
y = 1
James Tursa
James Tursa 2020 年 1 月 24 日
Do you have any ideas for how to do this? What would the algorithm be?
Jose Morales
Jose Morales 2020 年 1 月 24 日
I do not. I'm new to this and I'm confused just as you are. Here's the full question:
To test your understanding of assignment statements, write a few lines of code that swap the values of x and y. Put your code in a script called swap and test it

サインインしてコメントする。

回答 (1 件)

カテゴリ

ヘルプ センター および File ExchangeVerification, Validation, and Test についてさらに検索

タグ

質問済み:

2020 年 1 月 24 日

回答済み:

2020 年 1 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by