0
Wap to chek the given number to even or add
Wap to chek the given number to even or add
3 Answers
+ 5
What do you mean with "wap"? Anyway, to check if a number is even or odd just use modulo. number%2 will return 0 if the number is even, otherwise it will return 1.
+ 3
int num;
cin >> num;
if (num%2 == 0) {
cout << "number is even";
} else {
cout << " number is odd";
}
+ 1
Please example