How to find even or odd no using function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to find even or odd no using function

I want to know how to find whether the no is even or odd using void test() function

20th Dec 2016, 12:14 AM
swarali Jagdale
1 Answer
0
you can use the modulo operand, e.g void evenOrOdd (int num) { if (num % 2 == 0) { court << "even"; } else { court << " odd"; } }
20th Dec 2016, 12:28 AM
Robert Lyon
Robert Lyon - avatar