Why write code that already exists?
Programs often need to perform common jobs such as finding a remainder, carrying out integer division, rounding a value or creating a random number.
A library routine is a ready-made piece of code provided by the programming language. You call it by name instead of writing the whole process yourself.