can anyone show me how to go about this.
I've been trying to use a log to base 2
in c. the code atually works but it requires
me to type in a char after typing the number
i'm getting the log of

#include<stdio.h>
#include<limits.h>
#include<math.h>


void main()
{
	printf("min_int = %i\n", INT_MIN);
	printf("max_int = %i\n", INT_MAX);

	int Log10(INT_MAX)
	{
		Log10 = Log(INT_MAX) / Log(10);
		return Log10;
	}


	printf("This is a = %i -bit system\n", Log10(INT_MAX)+1);

}

What's a wonderful nightmare code! ;)..
Log10 denotes decimal (base10) logarithm.
Obviously, you want

log((double)INT_MAX)/log(2.0) + 1

Some addition.
It's the case where you don't need any logarithms.
If you know about limits.h header, look at:

int BitsInWord() {
    unsigned allones = ~0;
    int n;
    for (n = CHAR_BIT; allones >>= CHAR_BIT; n += CHAR_BIT)
        ;
    return n;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.