C Program to print binary equivalent of Integer | Binary equivalent of integer

Spread the love
/********** Program ***********/
#include<stdio.h>
main()
{
int n,i;
printf(“Enter any Number : “);
scanf(“%d”,&n);
for(i=31;i>=0;i–)
{
printf(“%d”,((n>>i)&1) ? 1 : 0);

if(i%8 == 0)
printf(” “);
}
}

/************* OUTPUT **********/


Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply