Need suggestions

Discussion in 'C' started by karun_happy, Dec 14, 2006.

  1. karun_happy

    karun_happy New Member

    Joined:
    Nov 17, 2006
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    can anyone tell me the logic or source code of the program whose out put is like
    Code:
                                   5  4  3  2  1
                                       4  3  2  1
                                           3   2 1
                                                2 1
                                                   1
    
    THans
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,376
    Likes Received:
    388
    Trophy Points:
    83
    You should start some coding at least
     
  3. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    Yes, try at least, and post it here when you get stuck.
    It's quite easy, try printing this first.

    1
    12
    123
    1234
    12345
     
  4. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    http://www.daweidesigns.com
    Here's a suggestion. It's not meant to be derogatory; but a serious suggestion. If you plan to be a programmer, as opposed to a hobbyist, then you need to understand this: understand, specify, and design before you ever think about pounding out code. Think about your requirements. From what I can tell, from your post, you want to begin with 5 digits, print them, remove one digit, print that, and wash, rinse, and repeat until you have exhausted all the digits. Further, you apparently want them to be right-aligned. Think about how you remove one digit; there are a number of possibilities. Think about how you force right alignment (formatting? forcible inclusion of a space?). Think about if you want to deal with the number as a character representation of a number all the way through, or only at the end (the output process). Use pseudo-code. Use a flowchart. Use anything which your humanly abstract reasoning abilities can deal with and massage into the less abstract ways you have to deal with your Von Neumann machine and whatever language you are trying to use to beat it into submission. To even contemplate coding before you do this is the sign of a novice, a poorly trained programmer, or (even worse) a schlock.
     
  5. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    Very good suggestion DaWei. :)
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice