#include "stdio.h" #include <stdint.h> uint8_t my_function(unsigned char reg,int pos, int mode) { reg=(reg & ~(1<<pos) )|(mode<<pos); return reg; } int main() { uint8_t reg=0; int pos=0; int mode=0; scanf("%d",®); scanf("%d",&pos); scanf("%d",&mode); printf("%d",my_function(reg,pos,mode)); return 0; }
Test Cases
Test Results
Input
10 3 1
Expected Output
10