close
Problem Description
英文的 Odd 是「奇怪」的意思,Odd Number 當然就是「奇怪的數字」簡稱「奇數」。問題是「奇數」倒底是唸成「ㄐㄧ數」或是「ㄑㄧˊ 數」呢?
Input Format
輸入只有一行,其中含有一個整數 i。
Output Format
如果 i 是奇數,輸出 Odd;如果 i 是偶數,則輸出 Even。
Sample Input
1
Sample Output
Odd
-----*Problem from【ZeroJudge, An Online Judge System For Beginners】
My Answer
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. | #include<iostream> using namespace std; int main(void) { int i; while(cin>>i){ (i%2==0) ? cout<<"Even"<<endl : cout<<"Odd"<<endl; } return 0; } |
全站熱搜