• Post Reply Bookmark Topic Watch Topic
  • New Topic

pyramid of numbers

 
sai rama krishna
Ranch Hand
Posts: 496
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If 4023 I pass then I should see output like

      0
     2 2
   3  3 3
4  4 4  4
 
Campbell Ritchie
Sheriff
Posts: 52055
90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So there is no relationship between the numbers and how many times they are displayed?
 
sai rama krishna
Ranch Hand
Posts: 496
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No
 
Junilu Lacar
Sheriff
Posts: 9355
96
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sai rama krishna wrote:No

Of course there is. It's just not "display a digit as many times as its value."
 
sai rama krishna
Ranch Hand
Posts: 496
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First digit(i.e least digit) one time in first row
second digit(i.e next least digit) two times in two row
third digit(i.e next least digit) one time in three row

etc
 
Carey Brown
Bartender
Posts: 2131
26
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I normally don't post answers but I feel this thread has gone on way too long.

 
sai rama krishna
Ranch Hand
Posts: 496
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i will try. thank you
 
sai rama krishna
Ranch Hand
Posts: 496
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
below code produced below output


Input number: 5319
   5
  3 3
1 1 1
9 9 9 9




If i want below output as ascending order from first to second row to third row etc as below how to modify the code


Input number: 5319
   1
  3 3
5 5 5
9 9 9 9
 
Carey Brown
Bartender
Posts: 2131
26
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try copying the code correctly.
 
sai rama krishna
Ranch Hand
Posts: 496
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try copying the code correctly.


can you please elaborate on this? I was not clear
 
Henry Wong
author
Marshal
Posts: 22365
102
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sai rama krishna wrote:
If i want below output as ascending order from first to second row to third row etc as below how to modify the code


Well, obviously, you need to sort the input first.  Since this is likely a homework assignment, or following up a homework assignment for learning purposes -- what have you done so far to modify it?

Henry
 
sai rama krishna
Ranch Hand
Posts: 496
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this is likely a homework assignment, or following up a homework assignment


this is not. you assumption is wrong
 
Henry Wong
author
Marshal
Posts: 22365
102
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sai rama krishna wrote:
Since this is likely a homework assignment, or following up a homework assignment


this is not. you assumption is wrong


The impetus of the assumption is that you are doing this to learn.  Hence, my question of asking what have you done so far.

Now surely, this is not wrong?

Henry
 
sai rama krishna
Ranch Hand
Posts: 496
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me try with collection class and let you know about sorting as well
 
Campbell Ritchie
Sheriff
Posts: 52055
90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not post something which you wrote yourself that actually works. Never mind how well it works, just something that works. If you have something which works, however badly, you can improve it.
 
sai rama krishna
Ranch Hand
Posts: 496
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not post something which you wrote yourself that actually works.


i posted more than 50 comments with whatever i can. I do not know something that actually works. If i know would not have posted this question here. can you please provide solution. I am almost about to give up on this challenge
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!