49. WAP to print binary format of a given number.
#include<stdio.h>
void
main()
{
int number,bit,pos=31;
printf("Enter the number to display
its binary : ");
scanf("%d",&number);
L1:
bit=(number>>pos)&1;
pos--;
printf("%d",bit);
if(pos>=0)
goto L1;
printf("\n");
printf("Binary of %d
number",number);
}
Comments
Post a Comment