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 pointer?

4 Answers  


writw a program to insert an element in the begning of a doubly linked list

1 Answers  


code for selection sort?

1 Answers  


Is c an object oriented programming language?

1 Answers  


1. Write the function int countchtr(char string[ ], int ch); which returns the number of times the character ch appears in the string. Example, the call countchtr(“She lives in NEWYORK”, ‘e’) would return 3.

4 Answers  






inline function is there in c language?

4 Answers  


write a program to generate address labels using structures?

0 Answers   SJC,


Program to display given 3 integers in ascending order

1 Answers   N Tech,


Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)

2 Answers   HCL, IBM, Satyam, Vimal, Vimukti Technologies,


What is difference between array and pointer in c?

0 Answers  


write a reverse string to print a stars.(with out using logic) ***** **** *** ** *

2 Answers  


how can i calculate mean,median,mode by using c program

1 Answers   HCL,


Categories