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 size of union in c?

0 Answers  


what is a void pointer?

2 Answers  


What do you mean by keywords in c?

0 Answers  


what are bit fields? What is the use of bit fields in a structure declaration?

0 Answers   Flextronics, TISL, Virtusa,


Table of Sudoku n*n

0 Answers  






what does " calloc" do?

7 Answers   Cadence, Logos,


WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER

0 Answers  


Why data types in all programming languages have some range? Why ritche have disigned first time likethat?Why not a single data type can support all other types?

2 Answers   Excel,


Explain main function in c?

0 Answers  


Between macros and functions,which is better to use and why?

0 Answers  


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

0 Answers  


Explain the use of keyword 'register' with respect to variables.

0 Answers  


Categories