# include "stdio.h"
int fnIntegerbit(int);
int main()
{
int nNumber;
printf("Enter the number which you want to know the number of bit representation \n");
scanf("%d",&nNumber);
printf("Required number of Bits: %d\n",fnIntegerbit(nNumber));
return 0;
}
int fnIntegerbit(int nNumber)
{
int nSum=1;
int nLoop=0;
while(nSum <= nNumber)
{
nSum += nSum;
nLoop++;
}
return nLoop;
}
OUTPUT:
Enter the number which you want to know the number of bit representation
128
Required number of Bits: 8
Press any key to continue . . .
No comments:
Post a Comment