To check whether number is Even or Odd in C#

To check whether number is Even or Odd in C#

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

namespace value
{
    class EvenOrOdd
    {
        static void Main(string[] args)
        {
            int s;

            Console.WriteLine("Enter the number");
            s =int.Parse( Console.ReadLine());
            if (s % 2 == 0)
            {
                Console.WriteLine("Is Even number {0}", s);
            }
            else
            {
                Console.WriteLine("Is Odd number {0}", s);
            }
            Console.ReadLine();

        }
    }
}

output:-








Share this

Previous
Next Post »