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

Is there sort function in c?

572


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

3498


write a program to find out prime number using sieve case?

1632


What does printf does?

736


What is typedef struct in c?

578






can anyone please tell about the nested interrupts?

1671


if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above

705


What is the ANSI C Standard?

771


What are the 4 types of programming language?

576


State two uses of pointers in C?

636


What is difference between scanf and gets?

606


Can I initialize unions?

585


What are multibyte characters?

640


pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)

2197


What is a string?

662