What we will do here is show how to solve the first problem using some algebra. Once you have looked at this bit of maths try and apply the same principles to problem 2. The first stage is to read the question carefully. I have some pencils and some jars. There are two distinct statements.
Lets look at statement one first.
When there are four pencils in each jar there will be one jar left over In words the number of jars is equal to the number of pencils divided by four plus another one. This can be expressed using algebra. We have created an formula to calculate how many Jars there are. We have ended up with two linear equations. There are two ways to solve these.