Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 structure of c program?

1233


What is %d called in c?

1284


write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

2577


write a program to concatenation the string using switch case?

2156


Explain threaded binary trees?

1216


What is a newline escape sequence?

1164


Explain what does a function declared as pascal do differently?

1347


What is the use of getchar() function?

1186


Why does notstrcat(string, "!");Work?

1209


What is calloc in c?

1192


How can I manipulate strings of multibyte characters?

1159


What is the value of a[3] if integer a[] = {5,4,3,2,1}?

1148


code for replace tabs with equivalent number of blanks

2217


How is a null pointer different from a dangling pointer?

1089


What is the main difference between calloc () and malloc ()?

1241