Dễ 0 đã giải Tỷ lệ chấp nhận 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.

Ràng buộc

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

Ví dụ

Ví dụ 1
Đầu vào:
number = 14

Kết quả mong đợi:
expected = "even"
Đầu vào:
double number = 14;

Kết quả mong đợi:
std::string expected = "even";
Đầu vào:
double number = 14;

Kết quả mong đợi:
string expected = "even";

Giải thích

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

Ví dụ 2
Đầu vào:
number = 3.5

Kết quả mong đợi:
expected = "neither"
Đầu vào:
double number = 3.5;

Kết quả mong đợi:
std::string expected = "neither";
Đầu vào:
double number = 3.5;

Kết quả mong đợi:
string expected = "neither";

Giải thích

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

Tham khảo

Thử thách này đã được điều chỉnh cho CodeUtility. Hãy làm theo đề bài và các ràng buộc ở trên.

Học hỏi từ người khác

Giải pháp cộng đồng

Chưa có giải pháp nào được chia sẻ. Hãy giải thử thách này để đăng giải pháp đầu tiên.