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
How can I invoke another program or command and trap its output?
Is that possible to add pointers to each other?
write a program to display all prime numbers
What math functions are available for integers? For floating point?
What does. int *x[](); means ?
Explain why C language is procedural?
What are the benefits of c language?
What are register variables in c?
Can we replace the struct function in tree syntax with a union?
which is conditional construct a) if statement b) switch statement c) while/for d) goto
Which is more efficient, a switch statement or an if else chain?
What is typedf?
How do we declare variables in c?
What are the keywords in c?
What does 2n 4c mean?