Skip to content

apc-sps-007.c

Problem Statement

WAP to check a number is even or odd using bitwise operator

Metadata

Property Detail
Author Amit Dutta (amitdutta4255@gmail.com)
License MIT

Actions

Raw View on GitHub

💡 You can print or save this file by opening Raw and using your browser.

Source Code

#include<stdio.h>
int main() {
    int x, res = 1;
    printf("Enter a number : ");
    scanf("%d", &x);
    res = res & x;
    if (res == 0) {
        printf("\nInput %d is a even number.", x);
    }
    else {
        printf("\nInput %d is a odd number.", x);
    }
    return 0;
}