

var housePrice;
var percentRate;
var duration;
var monthlyRate = 0;
var monRate;
var totalmos;
var exRate;
var counter = 0;
var expvar;
var x;

function test(price, percent, time){

   housePrice = calc.price.value;
   percentRate = calc.percent.value;
   duration = calc.time.value;

   totalmos = duration * 12;
   monRate=((percentRate/100)/12);
   expvar = 1 + monRate;
   x = Math.pow(expvar,totalmos);

   monthlyRate = Math.round((housePrice * x * monRate) / (x-1));
   calc.result.value = monthlyRate;
}
