Since, there are [tex]12[/tex] boxes of books to put on shelves and each one box has [tex]31[/tex] books.
Therefore, total number of books to put on shelves are: [tex]12\times31 = 372[/tex] books
Since, each shelf holds [tex]18[/tex] books.
So, the number of shelf needed are given by: Total number of books divided by the number of books each shelf holds.
i.e., [tex]372 \div 18 = 20.67[/tex]
Therefore, in order to place all the books onto the shelves. There are 21 shelves needed.