54. WAP to print number of bits using for loop
#include<stdio.h>
void
main()
{
int pos,num,bit;
printf("Enter a number ");
scanf("%d",&num);
for(pos=31;pos>=0;pos--)
{
bit=num>>pos&1;
printf("%d",bit);
}
printf("\n");
}
Comments
Post a Comment