Cool, it seems you understood, we are waiting your re-written solution, so we could take it from there.sai rama krishna wrote:I need to write the below things
sai rama krishna wrote:do i need to change my approach
sai rama krishna half an hour ago wrote:I know my approach is bit hapazard. I need to write the below things
1. high level approach
2. next granular level approach till i can code
3. put proper method names and variable names
4. write the psuedo code
5. write actual code in editor or IDE
sai rama krishna wrote:need to modify somethings
Oh, yes, they do. (You can tell what time of year it is, can't youLiutauras Vilda wrote:. . . No one sits down and writes code right away. . . .
V. Anton Spraul wrote:This is perhaps the most important rule. You must always have a plan, rather than engaging in directionless activity.
All things are lawful, but not all things are profitable.
sai rama krishna wrote:i am filling the methods as above
Yes and No. Probably for the beginning, for the sake of clarity, you can and maybe even you should write:sai rama krishna wrote:Usually we do not see that scenario right where one method call take other method call as parameter?
sai rama krishna wrote:In my mind i was thinking i was able solve this challenge in 25 lines of code within in main method itself rather than introducing new 5 to 10 new methods but apparently writing all in main with 25 simple lines is not good idea in terms of readability to others or even to me later stages?
Liutauras Vilda wrote:Yes and No. Probably for the beginning, for the sake of clarity, you can and maybe even you should write:
It is more readable actually and more flexible, as in case you'd need to use userNumbers somewhere else, you wouldn't need to call that method once again.
sai rama krishna wrote:In my mind i was thinking i was able solve this challenge in 25 lines of code within in main method itself rather than introducing new 5 to 10 new methods but apparently writing all in main with 25 simple lines is not good idea in terms of readability to others or even to me later stages?
Liutauras Vilda wrote:So, looking visually to this figure, for the first line you need to add 2 spaces, right? For the second line 1 space, and for the third - none. Can you have a look to loop and see if you could somehow workout needed amount of spaces per iteration out of loop counter?
sai rama krishna wrote:space is not coming correct before digit
Post Yesterday 4:15:26 PM Subject: pyramid of numbers
To see what's happening with your spaces replace
" "
with
"."
Consider Paul's rocket mass heater. |