From the above method

When we take 20 as a number and write in binary digits it comes 10100 but when we use this number in decimals it show up as 40. Could you explain about this?