Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Need suggestions (http://www.go4expert.com/forums/need-suggestions-t2248/)

karun_happy 14Dec2006 23:29

Need suggestions
can anyone tell me the logic or source code of the program whose out put is like

                              5  4  3  2  1
                                  4  3  2  1
                                      3  2 1
                                            2 1


shabbir 15Dec2006 10:54

Re: Need suggestions
You should start some coding at least

pradeep 15Dec2006 14:10

Re: Need suggestions
Yes, try at least, and post it here when you get stuck.
It's quite easy, try printing this first.


DaWei 15Dec2006 23:29

Re: Need suggestions
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.

pradeep 15Dec2006 23:42

Re: Need suggestions
Very good suggestion DaWei. :-)

All times are GMT +5.5. The time now is 05:27.