Find number of ways..

The number of ways in which we can post 5 letters in 10 letter boxes is.....

I already have the answer given to me but I am not able to get there(Only answer is given not solution). Please answer with appropriate solution for understanding.

-

If you had only one letter, there would be $10$ ways to post it. With two letters you’d have $10$ ways to post the first letter, and no matter which letter box you used, you could still post the second letter in any of the $10$ letter boxes. Thus, you’d have $10^2$ possible choices. If this isn’t clear, imagine that the letter boxes are labelled A through J. If you post the first letter in box A, you can post the second in any of the $10$ boxes; that’s a total of $10$ different ways to post the two letters. If you post the first letter in box B, you can again post the second in any of the $10$ boxes; that’s another $10$ different ways to post the two letters. Thus, there are $10$ different ways to post the two letters for each of the $10$ ways to post the first letter, for a grand total of $10\cdot10=10^2$ ways to post the two letters.
Now just extent the reasoning. Each of those $10^2$ ways to post the first two letters can be combined with any of $10$ different ways to post the third letter, so there are $10^2\cdot10=10^3$ ways to post the first three letters. Two more arguments of the same kind lead to the conclusion that there are $10^5$ different ways to post the $5$ letters.
Note that I’m assuming that you’re allowed to post more than one letter in the same letter box. If that’s not the case, the reasoning is similar, but the answer is quite different. If you can post at most one letter in a box, there are still $10$ different ways to post the first letter. After you’ve done that, however, there are only $9$ ways to post the second letter, since you can’t use the first letter box again. Thus, you get only $10\cdot9$ different combinations of letter boxes for the first two letters. Similarly, after they’ve been posted you must pick one of the $8$ remaining letter boxes for the third letter, so each of the $10\cdot9$ ways of posting the first two letters gives you only $8$ ways of posting the first three. As a result, there are $10\cdot9\cdot8$ ways of posting the first three letters. Two more arguments of the same kind lead this time to the conclusion that there are $10\cdot9\cdot8\cdot7\cdot6=30,240$ different ways to post the letters if you can use each letter box at most once.