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
Write a C program to count the number of email on text
Can you pass an entire structure to functions?
Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays
Who is the main contributor in designing the c language after dennis ritchie?
How do we open a binary file in Read/Write mode in C?
Difference between constant pointer and pointer to a constant.
What is static volatile in c?
What is the most efficient way to store flag values?
Do string constants represent numerical values?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
What is page thrashing?
How do we make a global variable accessible across files? Explain the extern keyword?
State the difference between realloc and free.
Write a program to swap two numbers without using third variable in c?
Can you subtract pointers from each other? Why would you?