セクション 1. 章 33
single
Challenge: Even or Odd
メニューを表示するにはスワイプしてください
タスク
スワイプしてコーディングを開始
Write code that determines whether a number is even or odd.
A number is even if it is fully divisible by 2. We can check this using the remainder operator (%).
For example:
13 % 2gives1→ not fully divisible → odd.14 % 2gives0→ fully divisible → even.
We can use this property to distinguish between even and odd numbers.
Write the code inside the checkEvenOdd(num) function:
- If the number is even → make the
messagevariable equal to"The number is even". - If the number is odd → make the
messagevariable equal to"The number is odd".
Use two different if statements to do this.
The result will be displayed automatically below the function.
解答
すべて明確でしたか?
フィードバックありがとうございます!
セクション 1. 章 33
single
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください