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 how can you determine the size of an allocated portion of memory?
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
How can I ensure that integer arithmetic doesnt overflow?
Explain how do you determine the length of a string value that was stored in a variable?
Explain what is the benefit of using an enum rather than a #define constant?
what will be maximum number of comparisons when number of elements are given?
Explain how can I read and write comma-delimited text?
Explain what are multidimensional arrays?
what are bit fields in c?
How will you print TATA alone from TATA POWER using string copy and concate commands in C?
Which is better pointer or array?
Explain the advantages of using macro in c language?
What are the different types of objects used in c?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
What are the advantages of the functions?