Thread: plaese help me...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    4

    plaese help me...

    Write a recursive function that takes as a parameter a non-negative integer and generated the following pattern of stars. If the non-negative is n, then the pattern generated is:

    n = 1
    1

    n = 2
    0
    010

    n = 3
    0
    010
    01010

    n = 4
    0
    010
    01010
    0101010


    thank u very much!!!
    Last edited by aloy; 02-29-2008 at 04:08 AM.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    And your question is?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    4

    question..

    my question is..anyone know how to produce the output like this..thank u 4 helping~

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Sure, I think I could cobble something up that does that.

    However, the principle for "homework" is that you post your effort, we help you along, and you learn something in the process, not "You post what the problem is and wait for the solution to be posted".

    Or in short: "Do your own homework".

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    For further details, read the forum rules.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed