you should consider using a modulus operator for several reasons.
In you code, when you divide by rempay, unless the result is a value greater than 1, the value you get for rempay will not give you the desired output. You have no conditions in your code to check whether the value of rempay before deducting the appropriate amount from it. to illustrate my point, consider
purchase = 27
pay = 30
when you divide by 20 and takeaway 20, rempay = 3,
then you devide by ten, tens is 0.3, and then your code deducts 10 from rempay without any set conditions, so rempay now becomes -7, and then folowing through the code , your output will give you the wrong values.
i suggest you use an if statement to check conditions whereby before you deduct the amounts, it checks to see how much, if any, you should deduct.
eg: from my ilustration
rempay= rempay - 20;
if(tens > 1)
rempay -= 10;
fives= int(rempay/5);
otherwise you should consider using the modulus function