Tech Study

Write Odd Even Program in C#

Introduction :

Odd Even Program in C#

Write C# Program to check whether entered number is odd or even. I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability..

using System;
 
namespace csharpprograms
{
    class Program
    {
        static void Main(string[] args)
        {
            int number;            
            Console.WriteLine("Enter a number: ");
            number = Convert.ToInt32(Console.ReadLine());
 
            // Even number if remainder is 0
            if (number % 2 == 0)
                Console.WriteLine("Entered Number is an Even Number");                
            else
                Console.WriteLine("Entered Number is odd Number");
 
            Console.ReadLine();
 
        }
    }
}

Result

Write C# Program to check whether entered number is odd or even
Write odd even program in c#

To know more about c# visit these links:

C# Program to convert days to years, weeks and days

C# Program to Multiply two Floating Point Numbers

TaggedWrite C# Program to check whether entered number is odd or even

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more