+ 3
How to write a program to find a number is even or odd. Print "even" or "odd" on screen conditions : don't use / % conditional statements if else switch and loops for while & do while
8 Antworten
+ 1
std::string array [2] = { "Even", "Odd" };
int a = 10;
cout <<array [ a & 1];
It's solvable and enjoy
- 1
are you sure not to use if-else?
without if-else...the question seems unsolvable
- 1
it is solvable without if-else
- 1
No, any conditional statements are not needed
- 1
my mind's not working....anyone got some idea???
- 1
I don't think its possible
- 1
If it's an integral number you have to check if the last bit is set. If so, it's uneven. Go from there.
- 1
no idea , may be its unsolvable