how to find the binary of a number?

Answer Posted / naresh m

main()
{
int a[12],n,m,i=0;
printf("enter the no to find binary no's");
scanf("%d",&n);
while(n!=0)
{
m=i++;
a[i]=n%2;
n=n/2;
}
printf("binary value is");
for(i=m;i>=0;i--)
{
printf("%d",a[i]);
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the size of enum in bytes?

594


What is #error and use of it?

684


What is the difference between Printf(..) and sprint(...) ?

792


Can we access array using pointer in c language?

650


What is calloc()?

633






Explain what is wrong with this program statement? Void = 10;

768


What is #include conio h?

598


Is c programming hard?

580


What is difference between static and global variable in c?

541


What is the size of a union variable?

604


explain what is a newline escape sequence?

693


given post order,in order construct the corresponding binary tree

2327


What is the difference between class and object in c?

588


What is wrong in this statement? scanf(ā€œ%dā€,whatnumber);

731


Is c is a high level language?

626