Here is the logic of decimal to binary convertion;
//before looping, after entering the decimal number
x=0;
quotient=DecNum/2;
remainder[x]=Decnum%2; // This is the initial binary number
//Inside loop
x++;
quotient=quotie nt/2;
remainder[x]=quotient%2;
// The loop will end if the value of the quotient will become <=1,
after the loop ends, you will have to reverse...
Leave a comment: