write a c program to check weather a particluar bit is set
or not?
Answer Posted / santhi perumal
#include<stdio.h>
#include<conio.h>
int main()
{
int number;
int position;
int result;
printf("Enter the Number\n");
scanf("%d",&number);
printf("Enter the Position\n");
scanf("%d",&position);
result = (number >>(position-1));
if(result & 1)
printf("Bit is Set");
else
printf("Bit is Not Set");
}
| Is This Answer Correct ? | 33 Yes | 12 No |
Post New Answer View All Answers
What is a stream?
Explain how can I remove the trailing spaces from a string?
How can I change the size of the dynamically allocated array?
What do you mean by keywords in c?
What is %s and %d in c?
What’s a signal? Explain what do I use signals for?
What are the salient features of c languages?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
What is static and auto variables in c?
Why do some versions of toupper act strangely if given an upper-case letter?
How will you declare an array of three function pointers where each function receives two ints and returns a float?
How do c compilers work?
Write a program to print fibonacci series without using recursion?
What is sizeof c?
What oops means?