Tech Study

Write a C# program to find even or odd number using function

Introduction

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 Functionexcercise
{
    class Program
    {      
 
        static void Main(string[] args)
        {
            int number;
 
            // Inputting number from user
            Console.WriteLine("Enter any number: ");
            number = Convert.ToInt32(Console.ReadLine());
 
            CheckNumIsEvenOrOdd(number);
            Console.ReadLine();
 
        }
 
        public static void CheckNumIsEvenOrOdd(int _number)
        {
            if (_number % 2 == 0)
            {
                Console.WriteLine("Number {0} is Even", _number);
            }
            else
            {
                Console.WriteLine("Number {0} is Odd", _number);
            }
        }
 
    }
 
}

Result

Write a C# program to find even or odd number using function
Write a C# program to find even or odd number using function

TaggedWrite a C# program to find even or odd number using function

Python Examples

Introduction: Python Examples are the basic programming concepts of python like python syntax,python data types,,python operators,python if else,python comments etc.. …

Read more

C String Functions

C String Functions perform certain operations, It provides many useful string functions which can come into action. The <string.h> header …

Read more