I am trying to say " if a number is divided by 2 and the modulus is equal to 1"

if(count/2% == 1)

or

if(%(count/2) == 1)

It's not working. What am I doing wrong? Would really appreciate help. Thanks.

Recommended Answers

All 2 Replies

if ((count % 2) == 1)

oops! I posted this before realizing it was Java...Sorry in advance if the syntax is wrong.

It worked. Thank you very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.