+ 4
how to write a program in c++ finding the number is even or odd
5 ответов
+ 8
cin>>i;
if (i%2==0){cout<<"Number is even};
else{cout<<"Number is odd";}
+ 7
That, or simply
std::cout << "Number is " << (i % 2 ? "odd" : "even");
+ 5
thanks friends
+ 1
bool isodd(int x) { return x % 2; }
bool iseven(int x) { return !isodd(x); }