ง่าย 0 ข้อที่แก้แล้ว อัตราผ่าน 0%

Odd, Even, or Neither

Classify a number by whether it is an odd integer, an even integer, or neither.

Whole numbers divisible by 2 are even; other whole numbers are odd. A number with a fractional part is neither. Zero is even, and negative integers follow the same rule.

Implement number_parity(number).

Input

number: The number to classify.

Output

Return odd, even, or neither as lowercase text.

เงื่อนไข

−1,000,000 ≤ number ≤ 1,000,000. The input is finite and has at most two decimal places.

ตัวอย่าง

ตัวอย่างที่ 1
อินพุต:
number = 14

ผลลัพธ์ที่คาดหวัง:
expected = "even"
อินพุต:
double number = 14;

ผลลัพธ์ที่คาดหวัง:
std::string expected = "even";
อินพุต:
double number = 14;

ผลลัพธ์ที่คาดหวัง:
string expected = "even";

คำอธิบาย

14 = 2 × 7, so it is divisible by 2.

ตัวอย่างที่ 2
อินพุต:
number = 3.5

ผลลัพธ์ที่คาดหวัง:
expected = "neither"
อินพุต:
double number = 3.5;

ผลลัพธ์ที่คาดหวัง:
std::string expected = "neither";
อินพุต:
double number = 3.5;

ผลลัพธ์ที่คาดหวัง:
string expected = "neither";

คำอธิบาย

3.5 has a fractional part, so it is neither an odd nor an even integer.

แหล่งอ้างอิง

โจทย์นี้ปรับให้เหมาะกับ CodeUtility กรุณาทำตามคำชี้แจงและข้อจำกัดด้านบน

เรียนรู้จากคนอื่น

แนวทางจากชุมชน

ยังไม่มีวิธีทำที่เผยแพร่ ลองแก้โจทย์นี้เพื่อแชร์วิธีแรก