Even numbers

  • Thread starter Thread starter TCORDON
  • Start date Start date
TCORDON said:
How can i know if a number is even or not?

\\\
If Number Mod 2 = 0 Then
MsgBox("Even number!")
Else
MsgBox("Odd number!")
End If
///
 
: How can i know if a number is even or not?
:
: Thanks
:


Try (numberToCheck Mod 2 = 0). This returns true if 'numberToCheck' is even.
Otherwise, it returns false.

Ralf
 
If (N Mod 2 = 0) Then
'Number is even
Else
' Number is odd
End If

How can i know if a number is even or not?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top