SLPT: If you're not good at math, convert everything to binary first. Instead of 10 different numerals to deal with you only have two, so the…