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.

Provide Answer

5 Comments

What row and what column? How does row and column relate to the 2 numbers you input? Are they the same, i.e., the two input numbers ARE the row and column?
What do you do if the row and column are not (both) odd? Just do nothing? Just do one square of stars but not two concentric ones? What if only one (either row pr column) is odd but the other is even? What do you do then?
There is just so much missing from the problem definition that I can't answer.

Sign in to comment.

 Accepted Answer

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.

More Answers (1)

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?

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!