Code

#include<stdio.h>
#include<stdint.h>

int check(uint8_t reg, int pos){
    if(reg & (1 << pos)){
        return 1;
    }
    return 0;
}

int main(){
    uint8_t reg;
    int pos;
    scanf("%u %d", &reg , &pos);
    printf("%d",check(reg, pos));

    return 0;
}

Solving Approach

 

 

 

Upvote
Downvote
Loading...

Input

4 2

Expected Output

1