Find even or odd
Fri Nov 22 2024 11:41:06 GMT+0000 (Coordinated Universal Time)
Saved by
@Narendra
//{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
string oddEven(int n) {
// code here
if(n&1)
{
return "odd";
}
else{
return "even";
}
}
};
//{ Driver Code Starts.
int main() {
int t;
cin >> t;
while (t--) {
int N;
cin >> N;
Solution ob;
cout << ob.oddEven(N) << endl;
cout << "~\n";
}
return 0;
}
// } Driver Code Ends
content_copyCOPY
Comments