how to find a 5th bit is set in c program

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 ?    18 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is cohesion and coupling in c?

586


Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.

1761


What does 3 periods mean in texting?

592


What are identifiers c?

560


What is %d used for?

580






What are the disadvantages of c language?

614


Why & is used in c?

707


Can you return null in c?

590


What do header files do?

598


What is main () in c?

583


What is table lookup in c?

622


What is a method in c?

618


What does the format %10.2 mean when included in a printf statement?

1079


a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor

631


What happens if header file is included twice?

649