Find Index of least significant bit set in an Integer. ex.
int value is say 10001000 results should be 4.



Find Index of least significant bit set in an Integer. ex. int value is say 10001000 results should..

Answer / 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

More C Interview Questions

In C, What is the #line used for?

2 Answers  


What does int main () mean?

0 Answers  


Can we include one C program into another C program if yes how?

7 Answers   Infosys,


how to print the character with maximum occurence and print that number of occurence too in a string given ?

0 Answers   Microsoft,


Write a program which returns the first non repetitive character in the string?

0 Answers   Expedia,






What are the Advantages of using macro

0 Answers  


Why is python slower than c?

0 Answers  


Is it possible to pass an entire structure to functions?

0 Answers  


What are the similarities between c and c++?

0 Answers  


what is data structure.in linear and non linear data structures which one is better?Explain

3 Answers   Wipro,


develop algorithms to add polynomials (i) in one variable

0 Answers   Ignou, TCS,


What does the file stdio.h contain?

0 Answers  


Categories