pritesh


{ City } pune
< Country > india
* Profession *
User No # 59101
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 6
Users Marked my Answers as Wrong # 6
Questions / { pritesh }
Questions Answers Category Views Company eMail




Answers / { pritesh }

Question { Aptech, 152596 }

how to convert decimal to binary in c using while loop
without using array


Answer

#include
void main()
{
int j=0,n,i=1;
printf("\nenter no.=");
scanf("%d",&n);
while(n!=0)
{
j=j+((n%2)*i);
n=n/2;
i=i*10;
}
printf("%d",j);
}

Is This Answer Correct ?    6 Yes 6 No