Find Even Odd Number In C#

Hello Guys! Welcome To My Blog!

Find Even Odd Number In C#

Today we will be learn how to Find Even Or Odd Numbers
An Even is an integer that is exactly divisible by 2
An Odd is an integer that is not exactly divisible by 2

Program to check this is Even or Odd


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

namespace Even_Odd
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {//this while loop is used for take input from user again and again


                Console.WriteLine("Enter Any Number To Find It Is Even Or Odd");
                int num = int.Parse(Console.ReadLine());
                if (num % 2 == 0)//if number is divisible by 2 its print this is even number
                {
                    Console.WriteLine("This Is Even Number");
                }
                else //if number is not exactly divisible by 2 its print this is odd number
                {
                    Console.WriteLine("This is Odd Number");

                }
                
              
            }
        }
    }
}

Comments