this is my code , I think something wrong with the shift operator , I used them in embedded software but I don't know if it is ok to use them on normal code , I have written a code to do the same purpose but with the method of adding (2*10^digit) but it seems a lot easier to use shifts-if possible-, please help :
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double find_power(double x);
int main()
{
    double bin=00000000, dec , k ;
    printf("enter decimal number:\n");
    scanf("%d",&dec);
    for(;;)
    {
        k=find_power(dec);
        bin|=(1<<k);
        dec-=pow(2,k);
        if(dec==1)
        {
            bin|=(1<<0);
            break;
        }
        else if(dec==0)
        {
            bin&=(~(1<<0));
            break;
        }
    }
    printf("%d",bin);
    return 0;
}
double find_power(double x)
{
    double i=1,j=0;
    for(;;)
    {
        i*=2;
        if(x>=i)
        {
            j++;
        }
        else if(x<i)
        {
             break;
        }
    }
    return j;
}
 
     
    