Pages

Thursday, June 16, 2016

C Program to demonstrate use of bitwise AND operator.

/*
Example of bitwise AND operation on two numbers 30 and 25.

30 in binary is 00011110
25 in binary is 00011001

Bitwise AND operation on 30 and 25 is as under:

  00011110 
& 00011001
=========
  00011000 i.e. 24
*/

#include <stdio.h>
void main()
{
    int num1 = 30, num2 = 25;
    printf("Bitwise AND on num1 & num2 is: %d", num1&num2);
}

//Output
Bitwise AND operation on num1 and num2 is: 24

No comments:

Post a Comment