C# Program to check if the Number is Odd or Even

Introduction

This program in C# developed using .NET Framework 4.5 and Visual Studio 2013 will check if the entered number is a odd or even number. The Number is a even number if it is divisible by 2 and results with the reminder o0f zero.

C# Program to check if the Number is Odd or Even

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

namespace GinktageConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
           int input;
           Console.Write("Enter the Number : ");

           input = int.Parse(Console.ReadLine());

           if (input % 2 == 0)

           {
               Console.Write("The Number is an Even Number");         
           }
           else
           {
               Console.Write("The Number is an Odd Number");           
           }
           Console.ReadLine();

        }
    }
}

image

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

C# Compiler Error CS0442 – ‘Property’: abstract properties cannot have private accessors Reason for the Error You’ll get this error...
This is a really simple one . Below is a simple example of an enum called “Designation” defined with the...
This blog post explain the usage of the Checked Block in .NET and how you can use them in Visual...