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

What are the advantages of using Unions?

1069


How can I open files mentioned on the command line, and parse option flags?

1017


any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above

987


What is memcpy() function?

1050


How to implement a packet in C

2836


Is there a way to compare two structure variables?

1060


What is the best organizational structure?

1068


I heard that you have to include stdio.h before calling printf. Why?

1010


Is boolean a datatype in c?

1014


What is 'bus error'?

1094


swap 2 numbers without using third variable?

1086


Is main a keyword in c?

1086


What is the modulus operator?

1154


Can an array be an Ivalue?

1057


What does c value mean?

1117