Recently heard an interesting quiz and thought it will be fun to see the solution done programmatically. The quiz is as follows: A person bought an old car with over 170,000 miles on it. The odometer is a digital device with 6 digits. The odometer shows only full digits – no decimals. One day as the person was ready to leave home for work he noticed the odometer reading is a Palindrome (i.e. the digits are same when reading from front and back - like 175571). After driving about an hour (during this time he also stopped for a cup of coffee on the way) the person reached office. Surprisingly he noticed that the odometer reading is again a palindrome. The question is: How far is the home from the office?
I will admit I did not get the answer by programming – bur rather by trail and error and by intuition. I am trying to solve in Excel but have not finished. I have a good logic for COBOL – but do not have access to COBOL compiler. Will post the answer after hearing from expert readers. Thanks SbElectric
VB, Excel, C, COBOL
July 31, 2011 4:33 AM
March 31, 2012 7:34 PM