write a c program to check weather a particluar bit is set
or not?
Answer Posted / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
int m,n,o,p;
printf("enter the number :");
scanf("%d",&m);
printf("enter the bit position for checking it is set or reset :");
scanf("%d",&n);
o=m;
p=o>>(n-1);
p=p&1;
if(p==1)
printf("the bit is set");
else
printf("the bit is reset");
getch();
}
thank u
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Are pointers integers in c?
Difference between pass by reference and pass by value?
How can I make it pause before closing the program output window?
Why do we use c for the speed of light?
Combinations of fibanocci prime series
Add Two Numbers Without Using the Addition Operator
Write a program to print all permutations of a given string.
How to find a missed value, if you want to store 100 values in a 99 sized array?
what does static variable mean?
Explain what are compound statements?
When would you use a pointer to a function?
What is time complexity c?
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
Why isnt there a numbered, multi-level break statement to break out
Compare and contrast compilers from interpreters.