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 different categories of functions in c?
What are the advantages and disadvantages of c language?
Write a program to swap two numbers without using third variable in c?
What are reserved words with a programming language?
Explain Basic concepts of C language?
What is null pointer constant?
What are the features of c language?
How does free() know explain how much memory to release?
What are the 4 types of organizational structures?
In a switch statement, explain what will happen if a break statement is omitted?
Why clrscr is used after variable declaration?
What is string length in c?
Differentiate between the expression “++a” and “a++”?
What is the symbol indicated the c-preprocessor?
Is array a primitive data type in c?