/*
 input n=5 , k=1   ->  101 toggle position 1 ... if 1 make it 0...if 0 make it 1...
 output = 4        ->  100
 
 input n=2 , k=3   ->  010 toggle     ""   3...
 output = 6        ->  110
*/

#include <stdio.h>

int main() {
    int n,k,r;
    
    scanf("%d %d",&n,&k);
    
    r = (n ^ (1<<(k-1)));  // 101 ^ (001 << (1-1))
                           // 101 ^ (001)
                           // 100
    printf("%d",r);
}

Embed on website

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