New course! Every coder should learn Generative AI!
Try a free lesson0
I want a c++ program that compute odd and even numbers aybody please
2 Answers
+ 3
Just search the code playground writing "odd even" you can find many
https://code.sololearn.com/cnIBOzaPCuRE/?ref=app
https://code.sololearn.com/cgbZGfJrxeFA/?ref=app
https://code.sololearn.com/calK1Wy638zu/?ref=app
https://code.sololearn.com/cEk5ZLSrsIwe/?ref=app
https://code.sololearn.com/cbIMbMlv98LD/?ref=app
https://code.sololearn.com/cfgzZYW6PsX8/?ref=app
https://code.sololearn.com/cdsUtPofVwny/?ref=app
https://code.sololearn.com/cT7kNwj3eTFB/?ref=app
https://code.sololearn.com/cAUj6fo3z6tY/?ref=app
https://code.sololearn.com/cNeUk0H0gabs/?ref=app
https://code.sololearn.com/cfo81mOU92W7/?ref=app
https://code.sololearn.com/c0tH5cTRJN6L/?ref=app
https://code.sololearn.com/ciQn5HlfLI6K/?ref=app
https://code.sololearn.com/cN21yaizJsSW/?ref=app
0
The fastest and easiest way to determine whether a number is odd or even is by testing its lowest bit with a bitwise & operator (e.g., if (num&1)...). If the bit is 1 then the number is odd. If the bit is 0 then the number is even.