Hey, I am making a credit calculator and I can't figure out the formula to calculate the following things:

1.If I have a max sum which I can afford to pay monthly ( for instance 300\$) and a max number of months I can pay the sum for (for instance 5 months) I have to determine the sum I can withdraw persuming I have to pay 5x300=1500\$, knowing the interest (in %). The interest is calculated every month (not year).

2.If i know the sum I have withdrawn, the monthly sum I pay and the interest (in %), how do I calculate the time recuired to pay the credit? The interest is calculated again every month (not year).

3.If I have the amount of the sum I have withdrawn, the monthly sum I am paying and the number of months I am supposed to pa, how do I calculate the interest (in %)? The interest is calculated again every month (not year).