Input any number and find Even number and Not Even number

Discussion in 'C#' started by Patel, May 22, 2011.

  1. Patel

    Patel New Member

    Joined:
    Dec 5, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Lucknow
    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Enter the no. :");         
                int a = Int32.Parse(Console.ReadLine());
                if (a % 2 == 0)
                    Console.WriteLine("Even no. :");
                else
                    Console.WriteLine("Not even");
                    Console.ReadLine();
    
           }
        }
    }
     
    Last edited by a moderator: May 22, 2011

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice