// Online C++ compiler to run C++ program online
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int a;
cout<<"Enter the number";
cin>>a;
int answer = 0;
int i =0;
while(a!=0){
int bit = a & 1;
answer = (bit * pow(10,i)) + answer;
a = a>>1;
i++;
}
cout<<answer;
return 0;
}
Thanks you for commenting your questions. I will see question and respond you.