473,396 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Even numbers

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

Thanks
Nov 21 '05 #1
5 1236
"TCORDON" <tc******@hotmail.com> schrieb:
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
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2
TCORDON wrote:
How can i know if a number is even or not?

Thanks


Number mod 2 = 0 then even

Note: 0 is even
Nov 21 '05 #3
If (N Mod 2 = 0) Then
'Number is even
Else
' Number is odd
End If

"TCORDON" <tc******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
How can i know if a number is even or not?

Thanks

Nov 21 '05 #4
"TCORDON" <tc******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
: 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
Nov 21 '05 #5
Thank You all

"Siva M" <sh******@online.excite.com> wrote in message
news:ej**************@TK2MSFTNGP10.phx.gbl...
If (N Mod 2 = 0) Then
'Number is even
Else
' Number is odd
End If

"TCORDON" <tc******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
How can i know if a number is even or not?

Thanks

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Debbie Lucier | last post by:
How would I generate a even random number each time? I can generate a random number each time but not an even one? Here is the code I use for the random number from 1-100. <script...
2
by: Lance Hoffmeyer | last post by:
So, I have using the following to grab numbers from MS Word. I discovered that that there is a "special" rule being used for rounding. If a ??.5 is even the number is to rounded down (20.5 = 20)...
1
sonic
by: sonic | last post by:
During input validation, how would one decipher between even and odd numbers? I have to write a program that allows an individual to select numbers between 2-14, excluding odds. Here is a snippet...
17
by: Ron | last post by:
I want to write a program that will accept a number in a textbox for example 23578 and then in a label will display the sum of the odd and even number like this... the textbox containsthe number...
6
by: devoreband | last post by:
hey i wrote all my code but i need to print out only the even numbers so is there any predefined function i can use or what can structure i should be following? ........ 16 for(int r = 0;...
2
by: cmeekeen | last post by:
How do I square the numbers in the even rows? I have generated 100 integer random numbers in the range of 1 to 100 in array x(10,10). Private Sub Form_Activate() Const row As Integer = 10 Const...
25
by: melsayid | last post by:
The program always shows that the input is odd. int main () { int n, d; printf ("Enter a Number: "); scanf ("%d", &n); d=1; if (d==n)
30
by: bdsatish | last post by:
The built-in function round( ) will always "round up", that is 1.5 is rounded to 2.0 and 2.5 is rounded to 3.0. If I want to round to the nearest even, that is my_round(1.5) = 2 # As...
18
by: =?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?= | last post by:
Hello. It seems a year is all it takes for one's proficiency in C++ to become too rusty. Professionally, I've been away from the language (and from programming in general), but I still preserve...
2
by: colordrm88 | last post by:
Here is what I am supposed to do...Write a C++ program that asks for 10 numbers and prints the sum of only the even numbers. I also have to use an if statement and a while loop. Please please...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.