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
Explain the concept and use of type void.
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
What are header files in c programming?
What is sizeof array?
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.
What does return 1 means in c?
What tq means in chat?
What is a class c rental property?
Why is it usually a bad idea to use gets()? Suggest a workaround.
What is difference between structure and union in c programming?
What are different types of operators?
What does c mean in basketball?
plz let me know how to become a telecom protocol tester. thank you.
Can you write the function prototype, definition and mention the other requirements.
Does sprintf put null character?