Results 1 to 3 of 3
  1. #1
    haleigh is offline Member
    Join Date
    Aug 2009
    Posts
    1
    Rep Power
    0

    Unhappy Guyz, can you help me?

    i just can't get the right algorithm for this problems..

    i need to print an inverted diamond using asterisk. this program needs an input from the user..

    example #1:

    enter a number : 3

    output:

    *______*
    * *__* *
    * * * * *
    * *__* *
    *______*

    example #2:

    enter a number : 4

    output:
    *__________*
    * *______* *
    * * *__* * *
    * * * * * * *
    * * *__* * *
    * *______* *
    *__________*

    Another problem is that, print arrow-shaped asterisk..

    example #1:

    enter a number : 3
    output:
    ____*
    __* * *
    * * * * *
    __*__*
    __*__*
    __* * *

    example #2:

    enter a number : 4
    output:

    ______*
    ____* * *
    __* * * * *
    * * * * * * *
    ____*__*
    ____*__*
    ____* * *

    Thanks you guyz..
    your help is most appreciated

    note: the underscores in the output represents a space.
    The output in the first problem(inverted diamond), the asterisk in both sides should be straight. i got a problem in typing it using this..
    Last edited by haleigh; 08-08-2009 at 04:08 AM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Hello and welcome to the forum. Here we always encourage folks with questions to try to come up with a solution first and then post their solution attempt. This serves several purposes including showing us where the OP is making mistakes.

    Best of luck and I look forward to seeing what you've tried.

  3. #3
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •