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 can I invoke another program or command and trap its output?

1065


Is that possible to add pointers to each other?

1336


write a program to display all prime numbers

1927


What math functions are available for integers? For floating point?

1096


What does. int *x[](); means ?

1023


Explain why C language is procedural?

1171


What are the benefits of c language?

1125


What are register variables in c?

987


Can we replace the struct function in tree syntax with a union?

1252


which is conditional construct a) if statement b) switch statement c) while/for d) goto

1179


Which is more efficient, a switch statement or an if else chain?

982


What is typedf?

1081


How do we declare variables in c?

1022


What are the keywords in c?

1093


What does 2n 4c mean?

1200