奇偶判断
需求如下:
代码如下:
1 #include <iostream>
2 using namespace std; 3 int main() 4 { 5 int n; 6 cin>>n; 7 if(n%2==0) cout<<n<<" is even."<<endl; 8 else cout<<n<<" is odd."<<endl; 9 return 0; 10 }
写在最后:
哪里有不足或者错误的地方,欢迎小伙伴们进行指教,一起进步哦!