C# Program to Check Whether a Number is Even or Odd

In this C# program, we will take input from the user and check whether a number is even or odd. An Even number is a positive integer that is divisible by 2 and An odd number is a positive integer that is not divisible by 2. 

C# Program to Check Whether a Number is Even or Odd Code:

private static void Main(string[] args)
        {
            Console.WriteLine("Enter the No");
            int num = Int32.Parse(Console.ReadLine());
            if (num % 2 == 0)
            {
                Console.Write("Entered number {0} is an even number. ", num);
            }
            else
            {
                Console.Write("Entered number {0} is an odd number. ", num);
            }
            Console.ReadLine();
        }

C# Program to Check Whether a Number is Even or Odd Output:

C#-Program-to-Check-Whether-a-Number-is-Even-or-Odd

C#-Program-to-Check-Whether-a-Number-is-Even-or-Odd

 
Best quality Asp .Net Ajax Control Toolkit tutorials.

Give your valuable comments.

Name
Email
Comment
1 + 5 =
 

About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice