Drawing a rectangle and diamond using recursion

Hi everybody, I'm wondering if someone can help me out to write a code that draw a block and diamond each in a single run by using '*' in recursion.

Below are one 10X10 rectangle and 6X4 diamond.


**********
**********
**********
**********
**********
**********
**********
**********
**********
**********


**
* *
* *
* *
* *
* *
* *
* *
**

Note: I couldn't write the diamond here appropriately somehow.

Thanks in advance!





Last edited on
Do you have anything in terms of code yet? It would be very helpful to post what you have so far, we could then point you in the right direction.

Note: I couldn't write the diamond here appropriately somehow

Try putting it in output tags:

(Know that the actual format is lost in the first example and it is to just serve as an example of how to use the tags):
[output]
*
* *
* *
* *
*[/output]


   *
 *   *
*     *
 *   *
   *
Topic archived. No new replies allowed.