Geekpedia Tutorials Home

Building a C# Chat Client and Server

Building a C# Chat Client and ServerA step by step tutorial teaching you how to create your own chat client and chat server easily in C#, for local networks or the Internet.

in C# Programming Tutorials

Getting Hard Drive Information

Getting Hard Drive InformationA C# tutorial showing you how to make use of WMI to extract information on disk drives, such as model, capacity, sectors and serial number.

in C# Programming Tutorials

UPS Shipping Calculator

UPS Shipping CalculatorThis tutorial will teach you how to calculate the shipping cost based on the weight, height, length and depth of the box, the distance and the UPS service type.

in PHP Programming Tutorials

Create Your Own Rich Text Editor

Create Your Own Rich Text EditorCreating a Rich Text Editor using JavaScript is easier to do than you might think, thanks to the support of modern browsers; this tutorial will walk you through it.

in JavaScript Programming Tutorials
Search
Tutorials
Programming Tutorials
IT Jobs
From CareerBuilder

How to check if a number is odd or even?

On Sunday, April 24th 2005 at 12:00 AM
By Andrew Pociu (View Profile)
****-   (Rated 4 with 91 votes)
Advertisement
More C# Resources
The best way to see if a given number is odd or even is to use the modulus operator (%). The modulus operator returns the remainder when dividing two numbers. So if you do a modulus of 6 % 2 you get 0 because 6 divided by 2 doesn't have a remainder, therefore it's even. If you do 3 % 2 the remainder will be 1, therefore the number is odd.

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
else
{
// It's odd
}
Digg Digg It!     Del.icio.us Del.icio.us     Reddit Reddit     StumbleUpon StumbleIt     Newsvine Newsvine     Furl Furl     BlinkList BlinkList

Rate Rate this Knowledge Base article
Comment Current Comments
by Bossman on Tuesday, November 8th 2005 at 07:58 AM

Nice

by Tach on Thursday, November 17th 2005 at 11:24 PM

VERY nice. You wouldn't believe how I have been doing it in the past. Thanx!

by Alain Ramirez on Tuesday, March 7th 2006 at 02:11 PM

more efficient
int Num = 5;

if ((Num & 1) == 0)
{
// It's even
}
else
{
// It's odd
}

only work with bits not division...

by sai on Sunday, April 23rd 2006 at 05:24 PM

Thanx a bunch buddy... that really helped..

by Masood Mehmood on Tuesday, January 16th 2007 at 05:51 AM

more more efficient (save one more CPU cycle)

int Num = 5;

if (Num & 1)
{
// It's odd
}
else
{
// It's even
}

by gaurav on Friday, April 20th 2007 at 03:20 AM

How to find whether a number is even or odd without using conditional operator using C language??

by solidstatestorage on Wednesday, May 16th 2007 at 04:59 PM

int nNum = 5;

bool bOdd = (bool)(nNum & 0x1);

by Tom on Tuesday, May 22nd 2007 at 09:20 AM

\"bool bOdd = (bool)(nNum & 0x1);\"

Casting is not efficient.

by sreenadh on Saturday, August 4th 2007 at 10:08 AM

How to find whether a number is even or odd using bit fields using C language?

by Fero on Tuesday, October 9th 2007 at 02:54 AM

/// <summary>
/// Checks if the number if odd or even.
/// </summary>
/// <param name=\"number\">Number to check</param>
/// <returns>Returns true if Odd</returns>
public static bool OddOrEven(int number)
{
return ((Num & 1) != 0) ? true : false;
}

by solidstatestorage on Wednesday, October 31st 2007 at 01:10 AM

bool bOdd = (bool)(nNum & 0x1);

Casting is highly efficient - the compiler performs the cast not the CPU. The \'anding\' operation above takes exactly one clock cycle.

by Me on Wednesday, February 13th 2008 at 01:05 PM

Casting is not efficient. At runtime the CLR checks casting operations to ensure that casts are always to the object's actual type or any of its base type - if the CLR simply allowed the casting, there would be no type-safety (google 'type spoofing'). It's very easy to write code that will compile yet fail at runtime with an InvalidCastException.

by solidstatestorage on Wednesday, March 5th 2008 at 05:04 PM

The question was is reference to the C language, which has a native compiler; i.e. there is no runtime manager.

A managed system such a .Net won\'t even compile this:
bool bOdd = (bool)(nNum & 0x1);

It will complain about an invalid cast right from the get go. A native compiler such as C or C++ will allow this cast all day long without any complaints. In fact, older compilers didn\'t even require the cast. They figured you knew what you were doing. The cast just tells the compiler that \'yes, I know I\'m about to change the variable type\'.

The following is the compiled code for the above test (including the disassembly):

int _tmain(int argc, _TCHAR* argv[])
{
bool bOdd = (bool)(argc & 0x1);

return bOdd;
00401000 movzx eax,byte ptr [esp+4]
00401005 and eax,1
}
00401008 ret

In terms of execution, it\'s not going to get any faster than this.

by Me on Thursday, April 24th 2008 at 11:19 AM

You're discussing C/C++ in a C# FAQ.

by Arnab on Friday, March 6th 2009 at 05:21 AM

int num = 000;
cout<<"Enter the number:";
cin>>num;
if(num%2==0)
{
cout<<"This number is a Even Number.";
}
else
{
cout<<"This number is a Odd Number";
}
getch();
}

by zeonardo on Tuesday, July 21st 2009 at 02:26 PM

Dude! Get a room!
You guys are Geek indeed!
It\'s just Even or Odd... Like child play!
If I ever need a \"clock\" it\'d hang one on my kitchen wall.

There\'s a world out there. Full of girls.
Go get it tiger!
^^

by thippu on Saturday, August 22nd 2009 at 09:19 AM


int num;
cout<<"Enter the number:";
cin>>num;
clscr()
if(num%2==0)
{
cout<<"This number is a Even Number:/n";
}
else
{
cout<<"This number is a Odd Number:"/n;
}
getch();
}

by thippu on Saturday, August 22nd 2009 at 09:19 AM


int num;
cout<<"Enter the number:";
cin>>num;
clscr()
if(num%2==0)
{
cout<<"This number is a Even Number:/n";
}
else
{
cout<<"This number is a Odd Number:"/n;
}
getch();
}

by thippu on Saturday, August 22nd 2009 at 09:19 AM


int num;
cout<<"Enter the number:";
cin>>num;
clscr()
if(num%2==0)
{
cout<<"This number is a Even Number:/n";
}
else
{
cout<<"This number is a Odd Number:"/n;
}
getch();
}

by thippu on Saturday, August 22nd 2009 at 09:19 AM


int num;
cout<<"Enter the number:";
cin>>num;
clscr()
if(num%2==0)
{
cout<<"This number is a Even Number:/n";
}
else
{
cout<<"This number is a Odd Number:"/n;
}
getch();
}

by LOLCOW on Wednesday, September 2nd 2009 at 11:27 PM

how about if you're also writing the code for not just odd or even, but if the number is zero as well?

by Duh on Monday, October 19th 2009 at 09:52 AM

if(num ==0)

by eye on Thursday, November 12th 2009 at 11:46 AM

dsgdthfth6r

by Some Dude on Wednesday, December 2nd 2009 at 01:48 PM

Now do it with an array!

by hii on Friday, January 8th 2010 at 02:43 AM

int m;
if(m/2*2==0)
cout<<"no. is even";
else
cout<<"no. is odd";

by tahir on Monday, March 8th 2010 at 06:59 AM

i need similar program but using only IF STATEMENT.

by nituko on Saturday, March 13th 2010 at 10:49 PM

how to determine a number is even or not without dividing or without taking modulus operator?

one way is to store all the even numbers in array and proceed by comparison is number with the number given by the user. But it cannot be efficient method to store all the even numbers in the array.

So what is the more efficient method to determine the number as an even or odd without using modulus operator?

by nituko on Saturday, March 13th 2010 at 10:49 PM

how to determine a number is even or not without dividing or without taking modulus operator?

one way is to store all the even numbers in array and proceed by comparison is number with the number given by the user. But it cannot be efficient method to store all the even numbers in the array.

So what is the more efficient method to determine the number as an even or odd without using modulus operator?

by yash on Saturday, March 20th 2010 at 06:17 AM

u fuck

by ke on Friday, April 9th 2010 at 11:46 PM

how do you do this is visual basic?

by shani on Monday, May 24th 2010 at 03:13 AM

thanks alot its very helpfull

by Anandh on Friday, July 23rd 2010 at 05:29 AM

find odd or even using simple if in c?

#include "stdafx.h"

int main(int argc, char* argv[])
{
printf("Hello World!\n");
int a,b;
scanf("%d",

by Anandh on Friday, July 23rd 2010 at 05:29 AM

find odd or even using simple if in c?

#include "stdafx.h"

int main(int argc, char* argv[])
{
printf("Hello World!\n");
int a,b;
scanf("%d",

by Anandh on Friday, July 23rd 2010 at 05:29 AM

find odd or even using simple if in c?

#include "stdafx.h"

int main(int argc, char* argv[])
{
printf("Hello World!\n");
int a,b;
scanf("%d",

by Anandh on Friday, July 23rd 2010 at 05:29 AM

find odd or even using simple if in c?

#include "stdafx.h"

int main(int argc, char* argv[])
{
printf("Hello World!\n");
int a,b;
scanf("%d",

by rathna on Friday, July 30th 2010 at 12:10 AM

how to use the for loop and while loop in simple programs of C language?

by jek on Wednesday, August 11th 2010 at 11:18 AM

using system;

namespace Even_Odd
{
class Program
{
int x;
Console.Write("Enter number");
x=int.Parse(Console.ReadLine());
if(x%2==0)
{
Console.WriteLine("Even");
Console.ReadLine();
}
else
{
Console.WriteLine("Odd");
Console.ReadLine();
}
}
}

by Nans on Friday, August 27th 2010 at 10:08 AM

i want to find even and odd nos. in vb pl help i am new to programing language...

by jayshree bhujbal on Sunday, September 12th 2010 at 06:19 AM

wap for accept ten int into an array find totalof all even

by Bani on Monday, September 27th 2010 at 11:58 PM

#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int x;
clrscr();
printf("Enter the number which you want to know even or odd");
scanf("%d",

by Bani on Monday, September 27th 2010 at 11:59 PM

#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
int x;
clrscr();
printf("Enter the number which you want to know even or odd");
scanf("%d",

by Muhammad Kazim on Thursday, October 14th 2010 at 04:42 AM

quit simple in conditional operator

int Num = 6;
Console.WriteLine(Num % 2 == 0 ? "even":"odd");

conditional operator use full links :
http://msdn.microsoft.com/en-us/library/ty67wk28(VS.80).aspx

http://msdn.microsoft.com/en-us/library/ms173224(VS.80).aspx

by Ehsan "zia" on Sunday, October 24th 2010 at 08:01 AM

thanks its so useful

by WITNESS on Sunday, November 28th 2010 at 08:30 AM

#include<iostream>
usinng namespace std odd or even;

by Bhushan Gupta on Thursday, December 16th 2010 at 10:41 PM

using system;

namespace Even_Odd
{
class NumEO
{
int x;
Console.Write("Enter number");
x=int.Parse(Console.ReadLine());
if(x%2==0)
{
Console.WriteLine("That's Even");
Console.ReadLine();
}
else
{
Console.WriteLine("That's Odd");
Console.ReadLine();
}
}
}

by Bhushan Gupta on Thursday, December 16th 2010 at 10:58 PM

using system;

namespace Even_Odd
{
class NumEO
{

Console.Write("Enter number");
int x = Convert.ToInt32(Console.ReadLine());
if(x%2==0)
{
Console.WriteLine("That's Even");
Console.ReadLine();
}
else
{
Console.WriteLine("That's Odd");
Console.ReadLine();
}
}
}

by Shaikh Sohail pakistan on Friday, December 24th 2010 at 06:37 AM

#include<stdio.h>
#include<conio.h>
void main()
{ clrscr() ;
int subject,topic;
printf("enter the number to find odd or even\n");
scanf("%d",

by Shaikh Sohail pakistan on Friday, December 24th 2010 at 06:37 AM

#include<stdio.h>
#include<conio.h>
void main()
{ clrscr() ;
int subject,topic;
printf("enter the number to find odd or even\n");
scanf("%d",

by sohail pakistan on Friday, December 24th 2010 at 06:39 AM

#include<stdio.h>
#include<conio.h>
void main()
{ clrscr() ;
int subject,topic;
printf("enter the number to find odd or even\n");
scanf("%d",

by jibrohni on Thursday, December 30th 2010 at 04:25 PM

you're all on crack

by mehnoosh on Thursday, March 3rd 2011 at 02:33 AM

why do num

by mehnoosh on Thursday, March 3rd 2011 at 02:33 AM

why do num

by mehnoosh on Thursday, March 3rd 2011 at 02:34 AM

why do num

by Jack on Saturday, May 14th 2011 at 12:30 PM

I have an 8 digit sequence of numbers, how can I get the numbers in the odd and even position?
ex:

int Number = 19345678;
while (Sin > 0)
{
int t = Number % 10;
Console.WriteLine(t);
}
console.read();

I want to get the number in the first, third, fifth and seventh position.

by Jack on Saturday, May 14th 2011 at 12:31 PM

I have an 8 digit sequence of numbers, how can I get the numbers in the odd and even position?
ex:

int Number = 19345678;
while (Number > 0)
{
int t = Number % 10;
Console.WriteLine(t);
}
console.read();

I want to get the number in the first, third, fifth and seventh position.

by farwa on Saturday, June 4th 2011 at 05:42 PM

Write a program, with a function called odd() that tells whether a number is odd or not. The function odd() should take an int value as an argument and returns the result as a boolean value. The values should be passed on by the user.
someone know what is the code of this program?

by best on Monday, June 20th 2011 at 02:43 PM

continue

by Paul on Monday, June 20th 2011 at 11:38 PM

@farwa, yes, yes, I know. :-)

It's this:
public static bool IsOdd(this double number)
{
return !number.IsEven();
}

public static bool IsEven(this double number)
{
bool result = false;

if (number > Int64.MaxValue)
{
result = number % 2 == 0;
}
else
{
result = (Convert.ToInt64(number)

by ketaki on Monday, July 11th 2011 at 06:08 AM

) Write a program that reads in an integer that represents the number of iterations. The program then uses a counter-controlled loop to determine all the odd numbers between 1 and the number entered and sums those values.

PLZ any one can help me to get this solution in C

by ketaki on Monday, July 11th 2011 at 06:08 AM

) Write a program that reads in an integer that represents the number of iterations. The program then uses a counter-controlled loop to determine all the odd numbers between 1 and the number entered and sums those values.

PLZ any one can help me to get this solution in C

by Shaikh Sohail on Monday, July 11th 2011 at 08:01 AM

Simple Syntax in C language

int a=5;
if(a%==0)
{printf("the value of a is %d even ",a);
}
else
{printf("Value is Odd : ",a);
}

by Shaikh Sohail on Monday, July 11th 2011 at 08:01 AM

Simple Syntax in C language

int a=5;
if(a%==0)
{printf("the value of a is %d even ",a);
}
else
{printf("Value is Odd : ",a);
}

by Shaikh Sohail (Pakistan) on Monday, July 11th 2011 at 08:07 AM

you can try this dear
int a,i,j=0,G=0;
scanf("%d",

by Gautham on Friday, July 15th 2011 at 05:36 PM

I came across http://rindovincent.blogspot.com/p/javascript.html where there was a simple Javascript program to find whether the number is odd or even. I am pasting the same code with permission here.

<html>
<head>
<script type="text/javascript">
var n = prompt("Enter a number to find odd or even", "Type your number here");
n = parseInt(n);
if (isNaN(n))
{
alert("Please Enter a Number");
}
else if (n == 0)
{
alert("The number is zero");
}
else if (n%2)
{
alert("The number is odd");
}
else
{
alert("The number is even");
}
</script>
</head>
<body>
</body>
</html>

by mohamed egy. on Saturday, July 16th 2011 at 08:20 AM

loop for numbers then when you press "9" it close the loop and calculate how many odd and even numbers?

can any one help me to get the solution of this task in c# ,Thanks:)

by Shaikh Sohail(Pakistan on Saturday, July 16th 2011 at 11:28 PM

int a=5;
if(a%2==0)
{printf("the value of a is %d even ",a);// for 'C'
Cosole.Write("Value is even " a);// C Sharp
System.out.println("Value is even " a);//Java
}
else
{printf("Value is Odd : ",a);
}

by Shaikh sohail(Pakistan) on Saturday, July 16th 2011 at 11:32 PM

button press is not allow when loop is continue dear mohamed i can do for jst this that when 9 is come then loop was stop and show you how many odd

by jancarl on Friday, July 29th 2011 at 02:36 AM

How to create a program that would determine if the number is either positive or negative integer?

by ellimac on Sunday, August 7th 2011 at 04:13 AM

if it is greater than 0
example:
n>o it is positive else it is negative

by Shaikh Sohail on Monday, August 8th 2011 at 02:05 PM

int a=-3;
if(a>=0)
{
print("The number is Positive");
}
else
{
print("The number is Negative");
}
Simple

by Shaikh Sohail on Monday, August 8th 2011 at 02:06 PM

int a=-3;
if(a>=0)
{
print("The number is Positive");
}
else
{
print("The number is Negative");
}
Simple

by Deejay on Thursday, August 11th 2011 at 09:18 AM

Determine if a number is odd or even and
Determine if a number is
positive even
negative even
positive odd
negative even

by Deejay on Thursday, August 11th 2011 at 09:18 AM

Determine if a number is odd or even and
Determine if a number is
positive even
negative even
positive odd
negative even

by Deejay on Thursday, August 11th 2011 at 09:26 AM

Determine if a number is odd or even and
Determine if a number is
positive even
negative even
positive odd
negative even

by Shaikh Sohail Pakistan on Friday, August 12th 2011 at 12:45 AM

int a=-2;
if(a%2==0)
{ if(a>0) { printf(positve even) }
else {printf(negative even) }
}
else
{ if(a>0)
{ printf(positve Odd) }
else{printf(negative Odd) }
}

by Shaikh Sohail Pakistan on Friday, August 12th 2011 at 12:48 AM

you can also contact me with mail
skygocomputer@yahoo.co.in

if you face some problem send me a mail INSHA ALLHA i will try to solve that

THANX SOHAIL SHAIKH
skygocomputer@yahoo.co.in

by jaden on Monday, November 28th 2011 at 01:57 AM

mod
doesnt work with negative number!

by surender kumar on Monday, December 12th 2011 at 02:19 AM

i want to more c program than you can send to me program to my email id

by surender kumar on Monday, December 12th 2011 at 02:19 AM

i want to more c program than you can send to me program to my email id

by surender kumar on Monday, December 12th 2011 at 02:20 AM

i want to more c program than you can send to me program to my email id

by unsecured credit cards for bad credit on Tuesday, December 20th 2011 at 08:09 PM

It was very useful for me, thank you very much!

by kratika tiwari on Saturday, December 31st 2011 at 04:28 AM

write a program to perform addition of two matrix.

by kratika tiwari on Saturday, December 31st 2011 at 04:28 AM

write a program to perform addition of two matrix.

by greta lagarto on Thursday, February 23rd 2012 at 07:11 PM

how to check if a number is odd or even number?

by greta lagarto on Thursday, February 23rd 2012 at 07:11 PM

how to check if a number is odd or even number?

by greta lagarto on Thursday, February 23rd 2012 at 07:11 PM

how to check if a number is odd or even number?

by greta lagarto on Thursday, February 23rd 2012 at 07:11 PM

how to check if a number is odd or even number?

by Shaikh Sohail Pakistan on Friday, February 24th 2012 at 01:32 AM

int a=5;
if(a%2==0)
{printf("the value of a is %d even ",a);// for 'C'
Cosole.Write("Value is even " a);// C Sharp
System.out.println("Value is even " a);//Java
}
else
{printf("Value is Odd : ",a);
}

by Shaikh Sohail Pakistan on Friday, February 24th 2012 at 01:34 AM

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a[3][3],i,j,sum ;
printf("THIS IS A 3*3 MATRIX PROGRAM\n");
for (i=0;i<3;i )
{ printf("The row no is%d\n",i);
for(j=0;j<3;j )
{
scanf("%d",

by Shaikh Sohail on Friday, February 24th 2012 at 01:35 AM

Part 1 Of Matrix
int a[3][3],i,j,sum ;
printf("THIS IS A 3*3 MATRIX PROGRAM\n");
for (i=0;i<3;i )
{ printf("The row no is%d\n",i);
for(j=0;j<3;j )
{
scanf("%d",

by Shaikh Sohail on Friday, February 24th 2012 at 01:37 AM

send me email if you want matrix add sub or multi program

by ForeclosureHelp on Friday, February 24th 2012 at 04:59 PM

Your blog is very informative. I really appreciate your hardwork. Thanks You for such good information. Keep up good work !!

by raviraj on Wednesday, February 29th 2012 at 10:19 AM

Here is a very way to find odd or even.

using System;
class MainClass
{
public static void Main(string[] args)
{
int i;
Console.WriteLine("Enter the Number:");
i=Convert.ToInt32(Console.ReadLine());
if((i%2)==0)
Console.WriteLine( "The Number is Even" );
else
Console.WriteLine( "The Number is Odd" );
}
}

by this website on Sunday, March 4th 2012 at 11:58 PM

It is surely very workable.

by click here on Wednesday, March 7th 2012 at 01:42 AM

Thanks for the blog.
<a href="http://www.allaboutdivorce.net">click here</a>

by StartCleaningService.com on Tuesday, March 13th 2012 at 03:18 AM

Thanks for the blog. The blog is very helpful and informative. Keep up the good work.

by StartCleaningService.com on Tuesday, March 13th 2012 at 03:18 AM

Thanks for the blog. The blog is very helpful and informative. Keep up the good work.

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:37 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:37 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:37 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:37 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:37 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:37 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:38 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:38 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:38 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:38 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:38 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:38 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:38 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:38 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:38 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by HelloMyNameIs on Wednesday, March 14th 2012 at 12:38 AM

int Num = 5;

if(Num % 2 == 0)
{
// It's even
}
if(Num % 2 != 0)
{
// It's odd
}

by master of education online on Thursday, May 10th 2012 at 02:11 AM

There are many people who simply prefer to use and read a brief guide books, which certainly will provide accurate and correct information for you.

by Munib on Wednesday, January 23rd 2013 at 07:14 AM

If some one enters a number and requires the answer as if i enter 12340 , compiler should tell me that how many even ,odd and zeroes are present in 12340

by Munib on Wednesday, January 23rd 2013 at 07:14 AM

If some one enters a number and requires the answer as if i enter 12340 , compiler should tell me that how many even ,odd and zeroes are present in 12340

by Munib on Wednesday, January 23rd 2013 at 07:14 AM

If some one enters a number and requires the answer as if i enter 12340 , compiler should tell me that how many even ,odd and zeroes are present in 12340

by Munib on Wednesday, January 23rd 2013 at 07:14 AM

If some one enters a number and requires the answer as if i enter 12340 , compiler should tell me that how many even ,odd and zeroes are present in 12340

by Munib on Wednesday, January 23rd 2013 at 07:14 AM

If some one enters a number and requires the answer as if i enter 12340 , compiler should tell me that how many even ,odd and zeroes are present in 12340

by Munib on Wednesday, January 23rd 2013 at 07:14 AM

If some one enters a number and requires the answer as if i enter 12340 , compiler should tell me that how many even ,odd and zeroes are present in 12340

by Munib on Wednesday, January 23rd 2013 at 07:15 AM

If some one enters a number and requires the answer as if i enter 12340 , compiler should tell me that how many even ,odd and zeroes are present in 12340

by Munib on Wednesday, January 23rd 2013 at 07:15 AM

If some one enters a number and requires the answer as if i enter 12340 , compiler should tell me that how many even ,odd and zeroes are present in 12340

by Matthew Hubbard on Thursday, March 7th 2013 at 12:41 PM

I am having issues with this assignment in VB 2010:

Code the application. Use the InputBox function to get the input. Save the solution and then start the application. Test the application using the following integers: 45,2,34,7,55,90 and 32. The sum of the odd and even integers should be 107 and 158 respectively.

Can someone please help me code this?

by vignesh on Friday, June 7th 2013 at 05:03 AM

please give notes for vb.net

by Johnny Boy on Thursday, January 16th 2014 at 01:26 PM

Here’s a blog article which benchmarks quite a few ways to test if a number is odd or even:
http://blogs.davelozinski.com/curiousconsultant/csharp-net-fastest-way-to-check-if-a-number-is-odd-or-even


There are actually numerous ways to do this other than the two you have listed. Surprisingly, the fastest way appears to be the modulus % operator, even out performing the bitwise ampersand

by Johnny Boy on Saturday, July 5th 2014 at 12:15 PM

The link in my above post is incorrect. It's now:
http://cc.davelozinski.com/c-sharp/fastest-way-to-check-if-a-number-is-odd-or-even

Thank you.

by sara on Monday, September 8th 2014 at 07:55 PM

hi , can you help me ?

write a matrix program ..

Suppose A={1,3,5,7,9} and B = {2,4,6,8,10}, create another array C of size 10 and put the data from A and B into C such that
C = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}


Comment Comment on this Knowledge Base article
Name: Email:
Message:
Knowledge Base Related Knowledge Base Articles
There are no related KB articles.

Comment Related Source Code
There is no related code.

Comment Related Tutorials
There are no related tutorials.

Jobs C# Job Search
My skills include:

Enter a City:

Select a State:


Advanced Search >>
Ads

From the creators of Geekpedia, a revolutionary new coupon website!

BargainEZ has coupons codes, printable coupons, bargains and it is the leading source of Passbook coupons for iPhone and iPod touch devices.

Coupons
Discover Geekpedia
Other Resources