i have following java script in my php program for Given integers n, l and r, find the number of ways to represent n as a sum of two integers A and B such that l ≤ A ≤ B ≤ r. and my code is...
<script>
function count(n, l, r) {
var result = 0;
for(var a = l; a <= r; a++){
for(var b = a; a <= r; b++){
if(a + b == n){
result++;
}
}
}
return result;
}
</script>
<?php
echo "<script>count(6,2,4);</script>";
?>
and i want to run this code on page load and call a function count() on load and give output. i don't know what to do.