#include"stdio.h"
#include"conio.h"
//show bits program
void showbits(int number)
{
int i=15;
printf("integer value represented in 16bits\n");
for(i=15;i>=0;i--)
{
int mask,bit;
mask=1<<i;
bit=number & mask;
bit==0? printf("0"):printf("1");
}
}
int main()
{
int number;
printf("Enter the integer number like(0-65535)\n");
scanf("%d",&number);
showbits(number);
getch();
return 0;
}
No comments:
Post a Comment