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

Are pointers integers in c?

1078


Difference between pass by reference and pass by value?

1164


How can I make it pause before closing the program output window?

1045


Why do we use c for the speed of light?

1215


Combinations of fibanocci prime series

1618


Add Two Numbers Without Using the Addition Operator

829


Write a program to print all permutations of a given string.

1201


How to find a missed value, if you want to store 100 values in a 99 sized array?

1415


what does static variable mean?

1115


Explain what are compound statements?

1064


When would you use a pointer to a function?

1052


What is time complexity c?

1001


in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above

1062


Why isnt there a numbered, multi-level break statement to break out

1057


Compare and contrast compilers from interpreters.

1121