Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

puts ((11.to_s * 2).to_i/2), does anyone know answer of this coding? I am not aware of ruby!

share|improve this question

closed as off topic by Sven, Khaled, Ward, Iain Jun 26 '12 at 7:12

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

This isn't a proper question at all and, being programming related, off-topic anyway. Please read our FAQ. – Sven Jun 26 '12 at 7:01
For your future reference this kind of question is better asked on – Iain Jun 26 '12 at 7:14

I just learned enough ruby to do this

ruby -e "puts ((11.to_s * 2).to_i/2)"

which doesn't help much

ruby -e "puts (11.to_s * 2)"

So it appears to convert 11 to a string (.to_s) then doubles it then converts the answer back to an integer (.to_i) and then divides it by 2.

share|improve this answer
thanks, it worked :-D – rumain Jun 26 '12 at 7:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.