[ad_1]
Asked
Viewed
23 times
// C program to find total bit in given number
#include <stdio.h>
#include <math.h>
error occurring part:
unsigned countBits(unsigned int number)
{
// log function in base 2
// take only integer part
return (int)log2(number)+1;
}
the main function:
// Driven program
int main()
{
unsigned int num = 65;
printf("%d\n", countBits(num));
return 0;
}
I want to make use of the log
function. How to modify this so that the program is still simple but errorless?
Dixitha R is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
lang-c
[ad_2]