Write a function that will take two numbers as input arguments and will print a set of concentric squares of stars whenever the row and column are odd.

1 回表示 (過去 30 日間)
Provide Answer
  5 件のコメント
Malik  McMillon
Malik McMillon 2016 年 10 月 31 日
編集済み: Walter Roberson 2016 年 10 月 31 日
>> fnname(5,5)
***
*** ***
Walter Roberson
Walter Roberson 2016 年 10 月 31 日
What would be the expected output for
fnname( sqrt(2), pi-4i )
?

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

採用された回答

James Tursa
James Tursa 2016 年 10 月 31 日
Here is a starting point:
1) Create a function m-file in your working directory with an appropriate name. E.g.,
edit mycircles.m
2) Put this code into this file:
% Add a description of the function, inputs & outputs, here
function mycircles(a,b)
% Insert your code for printing the "squares of stars" here
end
Add your description and your code in the places indicated.

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 10 月 31 日
Starting points:
To add to this, you need to find out what the question means. Is it the row and column indices that might or might not be odd, or is it based upon the content of some array? How big should the squares be? What should be printed for the other locations? What do the two input numbers have to do with the rest of the question?
  2 件のコメント
Malik  McMillon
Malik McMillon 2016 年 10 月 31 日
編集済み: Walter Roberson 2016 年 10 月 31 日
>> fnname(5,5)
***
*** **
Walter Roberson
Walter Roberson 2016 年 10 月 31 日
The only question that answers is what the name of the function should be.

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

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by