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
Here is a good puzzle: how do you write a program which produces its own source code as output?
What is the difference between test design and test case design?
What is operator promotion?
What is c standard library?
What is a stream water?
regarding pointers concept
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
What is restrict keyword in c?
Are pointers integer?
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
What are the 4 types of unions?
Why can’t we compare structures?
Why c is called a mid level programming language?
What are 3 types of structures?
What is file in c language?