455,513 Members | 1,604 Online
Need help? Post your question and get tips & solutions from a community of 455,513 IT Pros & Developers. It's quick & easy.

# for loop

 P: 1 i wnt to get this pattern 54321 4321 321 21 1 can any tell immediately plz send the answer to Email removed as per Posting Guidelines May 29 '07 #1
5 Replies

 Expert 100+ P: 181 i wnt to get this pattern 54321 4321 321 21 1 can any tell immediately plz send the answer to I suggest dont post ur email id in a public forum. try to find the number of digits ie 54321 has 5 digits, then do % on number 54321 % (10 power 4 ) would give 4321 54321 % (10 power 3 ) would give 321 and so on. May 29 '07 #2

 P: 34 Code removed as per Posting Guidelines hope this will help you..best wishes May 29 '07 #3

 P: 93 i wnt to get this pattern 54321 4321 321 21 1 can any tell immediately plz send the answer to Email removed as per Posting Guidelines I hope this code may help Code removed as per Posting Guidelines May 29 '07 #4

 100+ P: 208 Stop giving him code! This is for a homework assignment or somethign similar. He needs to learn how to do it not have it told to him. May 29 '07 #5

 P: 93 Stop giving him code! This is for a homework assignment or somethign similar. He needs to learn how to do it not have it told to him. OK. As it is a very simple thing only the matter is just to know with the syntax to do the specied task I entered the code. Any way now I am giving the Algorithmic hint now : 1. Get the highest number from user which needs to be displayed 2. Create one for loop for number of lines to display. In this for loop display new line char as the last statement 3. In the above for loop, nest one more for loop to display all the numbers which should appear on the screen 4. End your program for the outer "for loop" get the highest value as the initial value for the variable and keep decrementing till it reaches zero in successive iterations. In the inner for loop use Outer for loops variable as initial value and keep decrementing till it becomes zero in successive iterations. Thanks, Girish Kanakagiri May 30 '07 #6