<p>Enter a value between 0 and 9999, like 2347</p>
<input type="number" min="0" max="9999">
<button class="calculate">Calculate</button>

<div class="result"></div>




$('.calculate').on('click', function() {
  var inputVal = $('input').val();
  
  var th = Math.trunc(inputVal / 1000);
  var remainderTh = inputVal % 1000;
  
  var hun = Math.trunc(remainderTh / 100);
  var remainderHun = remainderTh % 100;
  
  var ten = Math.trunc(remainderHun / 10);
  var remainderTen = remainderHun % 10;
    
  $('.result').html('Result: ' +th+ '*10^3 + ' +hun+ '*10^2 + ' +ten+ '*10^1 + ' +remainderTen+ '*10^0');
});
Rerun