From: "Jan E." Date: 2012-06-12T01:32:28+09:00 Subject: Re: Chris Pine "Learning Programming" Question Hi, Michael Sung wrote in post #1064054: > QUESTION 1: For example, if I choose 99 as my number, left = number, and > write = left/100, wouldn't write = 99/100? In that case, why would > write > 0 return 'one hundred'? When you divide two integers in Ruby, you get an integer division rather than a "normal" division. You probably remember doing long division in elementary school. For example, 7 : 3 is 2 with a remainder of 1. This is exactly how integer division works: 7/3 is 2. And 99/100 is 0. So integer division always yields an integer rather than a float (fractional number). If you want to do "normal" division, either the dividend or the divisor has to be a float. Michael Sung wrote in post #1064054: > QUESTION 2: The second part of this code is just plain confusing me, > perhaps because I still can't figure out the first part which it builds > upon. The method basically calculates the hundreds, tens and ones of the number and builds the name from it. For example, the number 53 consists of 5 tens and 3 ones. The 5 tens mean that the name begins with "fifty". And the 3 ones mean that the name ends with "three". -- Posted via http://www.ruby-forum.com/.