#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    74
    Rep Power
    2

    Formatting using loop


    how am i gonna do this?
    Code:
    12345
    1234
    123
    12
    1

    i tried making it but i only get this result
    Code:
    1
    12
    123
    1234
    12345
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,407
    Rep Power
    1871
    If only there were a way to do x-- instead of x++ to make a loop go backwards....
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    74
    Rep Power
    2
    Originally Posted by salem
    If only there were a way to do x-- instead of x++ to make a loop go backwards....

    yes i have already tried using decrement before posting this, i get this result
    Code:
    54321
    4321
    321
    21
    1
    reverse of what im trying to achieve
  6. #4
  7. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,407
    Rep Power
    1871
    Isn't it obvious that one loop counts up, and the other loop counts down?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    74
    Rep Power
    2
    yeah, i know that. Hint not helping. anyway, thank you
  10. #6
  11. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,223
    Rep Power
    2222
    In case you haven't noticed, this forum is not called "Psychic Programming Friends Network." So then please stop expecting us to be able to read your mind and just post the code!
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    74
    Rep Power
    2
    i had it working. Thank You

    Please delete this thread if possible.

IMN logo majestic logo threadwatch logo seochat tools logo