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

what is a function pointer and how all to declare ,define and implement it ???

4 Answers   Honeywell,


Explain the use of 'auto' keyword

0 Answers  


What are file streams?

0 Answers  


WAP that prints the number from 1 to 100. but for multiplies of three print "XXX" instead of the number and for the multiplies of five print "YYY" . for number which are multiplies of both three and five print "ZZZ"

3 Answers  


Why do we use static in c?

0 Answers  






write a program to print infinte number

4 Answers  


Is the C language is the portable language...If yes...Then Why...and if not then what is problem so it is not a Portable language..???

2 Answers   TCS,


What is 2c dna?

0 Answers  


sir, i cannot find the way how to write aprogram by using array on queue

1 Answers   IISIT,


In scanf h is used for

4 Answers   BFL,


Explain what is operator promotion?

0 Answers  


what is the output of following question? void main() { int i=0,a[3]; a[i]=i++; printf("%d",a[i] }

3 Answers  


Categories