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
Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.
explain what are actual arguments?
How to write c functions that modify head pointer of a linked list?
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)
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
What is the scope of static variable in c?
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
What is the general form of #line preprocessor?
When should the const modifier be used?
What is the use of ?: Operator?
what is the basis for selection of arrays or pointers as data structure in a program
What is difference between union and structure in c?
What does char * * argv mean in c?
In C programming, what command or code can be used to determine if a number of odd or even?