I\'m converting an unsigned integer to binary using bitwise operators, and currently do integer & 1 to check if bit is 1 or 0 and output, then right shift by 1 to divide
I came up with a solution which dosesn't involve any application of bitwise operators. it is inefficient in terms of both space and time.
int arr[32];
for(int i=0;i<32;i++)
{
arr[i]=A%2;
A=A/2;
}
double res=1;
double re=0;
for(int i=0;i<32;i++)
{
int j=31-i;
res=arr[i];
while(j>0)
{
res=res*2;
j--;
}
re=re+res;
}
cout<<(unsigned int )re;