C#.Net Program 2 : Check whether the Entered Number is Even or Odd

C#.Net Program 2 : Check whether the Entered Number is Even or Odd

Program Explanation:

Program:

 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSharpExamples
{
    class Program
    {
        static void Main(string[] args)
        {
            int value;
            Console.WriteLine("Welcome to http://aspnettutorialonline.blogspot.com/");
            Console.WriteLine("Please Enter a Number : ");
            //Reading number
            value = int.Parse(Console.ReadLine());

            //condition for checking even or odd. 
            if (value % 2 == 0)
            {
                Console.Write("This is an Even Number");
                Console.Read();
            }
            else
            {
                Console.Write("This is an Odd Number");
                Console.Read();
            }
        }
    }
}


If you have any queries or suggestions, please feel free to ask in comments section.
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar