Picking any one of the two books there are five shelves to put it on - which makes five ways to place it and for each of those five ways there are four shelves the other book could go such that the two books are not on the same shelf. That's four ways to place a second book for each of the five ways to place the first. That's a total of 20 ways.