Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Checking if a Number is Even and Positive | Conditional Statements
Introduction to JavaScript

Glissez pour afficher le menu

book
Challenge: Checking if a Number is Even and Positive

Tâche

Swipe to start coding

Write a program that checks whether a given number is even and positive.

  • Use an if statement with the && operator to check if num is:
    • Greater than 0.
    • Even (divisible by 2).
  • If both conditions are true, print: "The number is positive and even.".
  • Otherwise, print: "The number does not meet the criteria.".

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 13

Demandez à l'IA

expand
ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

book
Challenge: Checking if a Number is Even and Positive

Tâche

Swipe to start coding

Write a program that checks whether a given number is even and positive.

  • Use an if statement with the && operator to check if num is:
    • Greater than 0.
    • Even (divisible by 2).
  • If both conditions are true, print: "The number is positive and even.".
  • Otherwise, print: "The number does not meet the criteria.".

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 13
Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Nous sommes désolés de vous informer que quelque chose s'est mal passé. Qu'est-il arrivé ?
some-alt