Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

bitwise even or odd

// C# program to check for even or odd
// using Bitwise AND operator
using System;
 
class GFG
{
     
    // Returns true if n is even, else odd
    static bool isEven(int n)
    {
        // n&1 is 1, then odd, else even
        return ((n & 1) != 1);
    }
         
    // Driver code
    public static void Main()
    {
        int n = 101;
        Console.Write(isEven(n) == true ? "Even" : "Odd");
    }
}
 
// This code is contributed by AnkitRai01
Comment

PREVIOUS NEXT
Code Example
Csharp :: Unity make a homing object 
Csharp :: c# class responsible for creating instances 
Csharp :: dotnet target specific framework 
Csharp :: trigger checkbox combobox wpf 
Csharp :: how to create vg in aix 
Csharp :: Program to find GCD or HCF of two numbers c# 
Csharp :: Post and Pre Increment operators in C# 
Csharp :: how to oppen a site using c# 
Csharp :: c# interface implementation 
Csharp :: c# read only file used by other app 
Csharp :: CRUD configuration MVC with Firebase 
Csharp :: hacking 
Csharp :: Open Windows Explorer to a certain directory from within a WPF app 
Csharp :: Avoid auto-filling persian time picker 
Csharp :: ef core unique index 
Csharp :: ? in c# 
Csharp :: conevrt list to pipe separated string c# 
Csharp :: how to play a random sound at the position that you want in unity 
Csharp :: Difference between Math.Floor() and Math.Truncate() 
Csharp :: unity how to get data of play session time in a text file? 
Csharp :: custom vscode snippet 
Csharp :: bitwise and c# 
Csharp :: copy file 
Csharp :: build a project from dotnet using cli 
Csharp :: c# get regedit value 
Csharp :: c# convert ad objectguid to string 
Csharp :: c# pass mouse events to parent 
Html :: ssss 
Html :: placeholder select html 
Html :: include script in html 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =