From 81bbb01f96ed38cea070f13d44b88d3dbd4fadcf Mon Sep 17 00:00:00 2001 From: Monalika Date: Wed, 26 May 2021 21:46:06 +0530 Subject: [PATCH] Create Program to toggle Kth bit of a number.cpp --- Program to toggle Kth bit of a number.cpp | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Program to toggle Kth bit of a number.cpp 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: "<