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

Explain what is a pragma?

0 Answers  


What is the use of a ‘’ character?

0 Answers  


Is c object oriented?

0 Answers  


What is pre-emptive data structure and explain it with example?

0 Answers  


How was c created?

0 Answers  


Is there a built-in function in C that can be used for sorting data?

0 Answers  


What is an lvalue?

0 Answers  


Write a program to add a given duration with time(24hrs format)

1 Answers   Protech,


What is a macro?

0 Answers  


What is the argument of a function in c?

0 Answers  


write an algorithm which can find the largest number among the given list using binary search ............... this was asked in the interview

2 Answers   Satyam, UNIS, Wipro,


What is hash table in c?

0 Answers  


Categories