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


Please Help Members By Posting Answers For Below Questions

What are the different categories of functions in c?

639


What are the advantages and disadvantages of c language?

550


Write a program to swap two numbers without using third variable in c?

607


What are reserved words with a programming language?

593


Explain Basic concepts of C language?

635






What is null pointer constant?

588


What are the features of c language?

616


How does free() know explain how much memory to release?

610


What are the 4 types of organizational structures?

614


In a switch statement, explain what will happen if a break statement is omitted?

619


Why clrscr is used after variable declaration?

1033


What is string length in c?

600


Differentiate between the expression “++a” and “a++”?

691


What is the symbol indicated the c-preprocessor?

688


Is array a primitive data type in c?

568