Monday, March 14, 2011

check whether given no is odd or even without using any type of arithmetic operator


#include<stdio.h>
void main()
{
    int i,n;
    
    printf("enter the number ");
    scanf("%d",&n);
    i=n&1;
    if(i==0)                                
    {
        printf("Given number is even");
    } 
    else
    {
        printf("Given number is odd ");
    }

}

No comments:

Post a Comment