Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int m,n,o,p;
printf("enter the number :");
scanf("%d",&m);
printf("enter the bit position for checking it is set or reset :");
scanf("%d",&n);
o=m;
p=o>>(n-1);
p=p&1;
if(p==1)
printf("the bit is set");
else
printf("the bit is reset");
getch();
}

thank u

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to create struct variables?

1173


How can I handle floating-point exceptions gracefully?

1250


Can a pointer be null?

1083


Explain the red-black trees?

1205


How do you use a 'Local Block'?

1230


What is meant by 'bit masking'?

1442


What is the difference between struct and typedef struct in c?

1175


Compare array data type to pointer data type

1085


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

3665


I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.

2409


How do I create a directory? How do I remove a directory (and its contents)?

1230


Is c a great language, or what?

1171


Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58

1581


How can I get back to the interactive keyboard if stdin is redirected?

1242


What is build process in c?

1206