write a c program to change only the 3rd bit of the
particular number such that other bits are not affected..
if bitnum=10(say.. it can be any no..
Answer Posted / ajay karanam
int main()
{
int number=0;
int bitTobeChanged=0;
int endResult=0;
printf("Enter the number\n");
scanf("%d",&number);
printf("Enter the bit to be changed\n");
scanf("%d",&bitTobeChanged);
endResult=number|(0x1<<(bitTobeChanged-1));
printf("End Result = %d\n",endResult);
return 0;
}
| Is This Answer Correct ? | 18 Yes | 10 No |
Post New Answer View All Answers
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
What is #include conio h?
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555
Under what circumstances does a name clash occur?
What are void pointers in c?
How many levels of pointers can you have?
What is a double c?
What is nested structure in c?
How can you access memory located at a certain address?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
How can you increase the size of a statically allocated array?
What are the 5 data types?
What is s in c?
Why are all header files not declared in every c program?
i have a written test for microland please give me test pattern