answersLogoWhite

0


Best Answer

int num, bin[50], dec, i=1, j;

printf("Enter the decimal number : ");

scanf("%d",&dec);

num = dec;

while(num!=0)

{

bin[i++] = num%2;

num = num/2;

}

printf("\nBinary equivalent of %d : ",dec);

for(j=i-1;j>0;j--)

{

printf("%d",bin[j]);

}

getch();

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program to convert a number into its binary equivalent?
Write your answer...
Submit
Still have questions?
magnify glass
imp