Find Index of least significant bit set in an Integer. ex.
int value is say 10001000 results should be 4.
Answer Posted / supri
I think the following code will help!!!!!!
#include<stdio.h>
main()
{
int a,count=0;
scnaf("%d",&a);
while(a)
{
if(a&1==1)
{
printf("%d",++count);
break;
}
a=a>>1;
++Count;
}
return;
}
Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
What is a list in c?
Here is a good puzzle: how do you write a program which produces its own source code as output?
what is the function of pragma directive in c?
What is the difference between array and structure in c?
How do I convert a string to all upper or lower case?
Tell me with an example the self-referential structure?
What will the preprocessor do for a program?
Write a program for finding factorial of a number.
What is %d called in c?
What are header files in c programming?
Explain what are reserved words?
What are the similarities between c and c++?
How can I call fortran?
When would you use a pointer to a function?
Explain how do you generate random numbers in c?