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
Write a program to identify if a given binary tree is balanced or not.
what value is returned to operating system after program execution?
What is the general form of #line preprocessor?
What does sizeof return c?
Can a local variable be volatile in c?
What are pointers really good for, anyway?
What is #include cctype?
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
What are keywords c?
How can I remove the trailing spaces from a string?
What is a char c?
Whats s or c mean?
How can I get random integers in a certain range?
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
What is a class c rental property?