Hello Learner
Contributor
Stats
 Views : 23113 Comments : 0 Rating : 0
Actions

# Program to check given number is Even or Odd using C#.NET

By Ashok Nalam on 17 Sep 2013 | Category: C# | Tagged: number .NET
In this snippet we will write a program to check whether the given number is even or odd using C#.NET.
 Rate this resource

### Introduction

In this snippet we will write a program to check whether the given number is even or odd.

What is Even/Odd number:

An Even number is an integer which is a multiple of two where as Odd number is an integer which is not a multiple of two. An integer that is not an odd number is an even number and vice- versa.

Example :

-4,-2,0,2,4,6,8,10... Even Numbers

-3,-1,1,3,5,7,9,11....... Odd Numbers

```using System;
namespace DotNetMirror
{
class NumberIsEvenOrOdd
{
public static void Main()
{
int number;
Console.WriteLine("Program To check Whether Entered Number is Even or Odd");
Console.WriteLine("-----------------------------------------------------------");
Console.Write("Enter a Number: ");
CheckNumIsEvenOrOdd(number);
}
public static void CheckNumIsEvenOrOdd(int _number)
{
if (_number % 2 == 0)
{
Console.WriteLine("Number {0} is Even", _number);
}
else
{
Console.WriteLine("Number {0} is Odd", _number);
}
}
}
}```

### Output:

Program To check Whether Entered Number is Even or Odd
-----------------------------------------------------------
Enter a Number: 19
Number 19 is Odd

 Rate this resource