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


Please Help Members By Posting Answers For Below Questions

What is a list in c?

792


Here is a good puzzle: how do you write a program which produces its own source code as output?

843


what is the function of pragma directive in c?

875


What is the difference between array and structure in c?

780


How do I convert a string to all upper or lower case?

863


Tell me with an example the self-referential structure?

751


What will the preprocessor do for a program?

773


Write a program for finding factorial of a number.

840


What is %d called in c?

939


What are header files in c programming?

846


Explain what are reserved words?

838


What are the similarities between c and c++?

797


How can I call fortran?

809


When would you use a pointer to a function?

797


Explain how do you generate random numbers in c?

810