Hello!
I made this program where user enters two whole numbers and program prints out cubes in given interval. Then I had to upgrade it for example, user enters number 4 and 5,–>my program prints “no cubes in given interval”. Now I upgraded it but it does not work properly, if i enter 1 and 99, it should print cubes in that interval, but it prints “No cubes in given interval”. I think there is some mistake but I am too beginner to find it out by myself.
[code]<!DOCTYPE html>
<html>
<body>
<button onclick=”myFunction()”>Try it</button>
<script>
function myFunction()
{
var m, n;
m = parseInt(prompt(“Enter first whole number m= “));
n = parseInt(prompt(“Enter second whole number n= “));
if(m>n) {
var a = n;
n=m;
m=a;
var c = parseInt(Math.cbrt(m));
if(c*c*c == m) {
alert(c);
}
c++;
while(c*c*c<=n) {
alert(c*c*c);
c++;
}
} else {
alert(“No cubes in given interval”);
}
}
</script>
</body>
</html>