write a c program to check weather a particluar bit is set
or not?

Answer Posted / santhi perumal

#include<stdio.h>
#include<conio.h>

int main()
{
int number;
int position;
int result;

printf("Enter the Number\n");
scanf("%d",&number);
printf("Enter the Position\n");
scanf("%d",&position);

result = (number >>(position-1));

if(result & 1)
printf("Bit is Set");
else
printf("Bit is Not Set");
}

Is This Answer Correct ?    33 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the concept and use of type void.

876


c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above

1025


What are header files in c programming?

863


What is sizeof array?

817


Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.

3406


What does return 1 means in c?

819


What tq means in chat?

853


What is a class c rental property?

865


Why is it usually a bad idea to use gets()? Suggest a workaround.

1367


What is difference between structure and union in c programming?

793


What are different types of operators?

786


What does c mean in basketball?

776


plz let me know how to become a telecom protocol tester. thank you.

1985


Can you write the function prototype, definition and mention the other requirements.

892


Does sprintf put null character?

803