Check if a number is even or odd without using any arithmetic operator. easy but tricky one :-)

Check if a number is even or odd without using any arithmetic operator



#include<stdio.h>
int main()
{
    int i,j,k,l;
    int n;
    printf("Enter the number to be checked even or odd\n");
    scanf("%d",&n);

    if((n&1)==0)
    {
        printf("This is even number\n");

    }
    else
    {
        printf("This is odd number\n");
    }
    return 0;

}

No comments:

Post a Comment

All Repeated Words In Text File And Their Occurrences In Java

Find All Repeated Words In Text File And Their Occurrences In Java Place your file location in the argument of the FileReader. If t...