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 to create struct variables?
How can I handle floating-point exceptions gracefully?
Can a pointer be null?
Explain the red-black trees?
How do you use a 'Local Block'?
What is meant by 'bit masking'?
What is the difference between struct and typedef struct in c?
Compare array data type to pointer data type
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
How do I create a directory? How do I remove a directory (and its contents)?
Is c a great language, or what?
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
How can I get back to the interactive keyboard if stdin is redirected?
What is build process in c?