#include <stdio.h>

int main() {
    int a,b,r,d,e; // set means 1 and reset means 0
    
    scanf("%d %d",&a,&b); // for 5 3
    
    r=(a & (1<<(b-1))); // 101 (001<<2) -> 101 & 100 = 100 -> 4
    
    d=(a ^ (1<<(b-1)));
    
    e=(a | (1<<(b-1)));
    
    printf("The & operator result is %d",r);
    
    printf("\nThe ^ operator result is %d",d);
    
    printf("\nThe | operator result is %d",e);
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: