diff --git a/Program to toggle Kth bit of a number.cpp b/Program to toggle Kth bit of a number.cpp new file mode 100644 index 0000000..08907e0 --- /dev/null +++ b/Program to toggle Kth bit of a number.cpp @@ -0,0 +1,33 @@ +#include +using namespace std; + +// K starts from 1 +// left shift 1 K-1 times and xor with number n +// 1<>num; + cout<<"Enter bit to toggle (value of k): "; + cin>>k; + + cout<<"Enter number: "<