write a c program to check weather a particluar bit is set
or not?

Answer Posted / valli

#include<stdio.h>
main()
{
int n,p;
printf("enter number");
scanf("%d",&n);
printf("enter the position");
scanf("%d",&p);
if(n&(1<<p))
printf("the bit is set");
else
printf("the bit is clear");
}

Is This Answer Correct ?    12 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how can f be used for both float and double arguments in printf? Are not they different types?

602


What are header files and explain what are its uses in c programming?

602


What are pointers really good for, anyway?

606


What is the concatenation operator?

601


Why dont c comments nest?

611






Explain what header files do I need in order to define the standard library functions I use?

642


Create a simple code fragment that will swap the values of two variables num1 and num2.

800


Why can’t we compare structures?

801


I have seen function declarations that look like this

590


What is the difference between memcpy and memmove?

593


Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.

1612


How can you pass an array to a function by value?

597


i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....

1512


What is signed and unsigned?

629


Explain 'far' and 'near' pointers in c.

695