This code reads in rate per week,amount borrowed and weekly installment. Output amoun owed at week n, and the total week it takes to finish paying off the loan.

(*rate=Input["rate per week, in % "];
amount=Input["amount borrowed"];
installment=Input["installment, per week"];*)
rate=2;
amount=5000;
installment=100;

interest1=(rate/100.0)*amount;

Print["installment=",installment];
Print["first week interest=",interest1];


If[installment<=interest1,
Print["You will never finish paying back your loan as the weekly interest is larger than your weekly installment"];
];

If[installment>interest1,
Print["You will be able to finish paying back your loan as the weekly interest is larger than your weekly installment"];

(** calculate amount owed in each week ***)
nlast=100;
Do[
interest=amount*(rate/100.0);
amount=amount+interest-installment;
Print[{n,amount}];
If[amount<0,
weekf=n;
Print["amount becomes negative in week ",weekf];
Break[]
];(*end if*)
,{n,1,nlast}
];(*end do*)
(*****)
];(*end if *)