Advertisement
hellom38

Javascript

Aug 16th, 2022 (edited)
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // program that checks if the number is positive, negative or zero
  2. // input from the user
  3. const number = parseInt(prompt("Enter a number: "));
  4.  
  5. // check if number is greater than 0
  6. if (number > 0) {
  7.     console.log("The number is positive");
  8. }
  9.  
  10. // check if number is 0
  11. else if (number == 0) {
  12.   console.log("The number is zero");
  13. }
  14.  
  15. // if number is less than 0
  16. else {
  17.      console.log("The number is negative");
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement