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
Can math operations be performed on a void pointer?
Should I learn data structures in c or python?
State two uses of pointers in C?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
What is array within structure?
What does sizeof return c?
write a program to reverse a every alternetive words in a string in a place. EX: Input is "this is the line of text" Output should be "shit is eht line fo text" Please any one tell me code for that.
Explain how can I convert a string to a number?
Why does not c have an exponentiation operator?
What are high level languages like C and FORTRAN also known as?
Differentiate between ordinary variable and pointer in c.
I need previous papers of CSC.......plz help out by posting them.......
What is sizeof int?
Explain two-dimensional array.
What is dynamic variable in c?