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
What are the advantages of using Unions?
How can I open files mentioned on the command line, and parse option flags?
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
What is memcpy() function?
How to implement a packet in C
Is there a way to compare two structure variables?
What is the best organizational structure?
I heard that you have to include stdio.h before calling printf. Why?
Is boolean a datatype in c?
What is 'bus error'?
swap 2 numbers without using third variable?
Is main a keyword in c?
What is the modulus operator?
Can an array be an Ivalue?
What does c value mean?