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

What is pointer to pointer in c?

888


Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.

1877


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2387


what type of questions arrive in interview over c programming?

1805


Which one would you prefer - a macro or a function?

879


What is a pointer value and address in c?

856


Are there namespaces in c?

828


Why do we use header files in c?

846


Why main function is special give two reasons?

1259


How do I determine whether a character is numeric, alphabetic, and so on?

904


What is volatile variable in c with example?

813


Why do we need a structure?

822


write a program to copy the string using switch case?

2668


Which is best linux os?

797


What will the preprocessor do for a program?

811