Write a JavaScript program to check whether the given number is positive or negative.



<script>

let num = parseFloat(prompt("Enter a number:"));

if (num > 0) {

    console.log("The number is positive.");

} else if (num < 0) {

    console.log("The number is negative.");

} else {

    console.log("The number is zero.");

}

</script>

Post a Comment

0 Comments