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 change only the 3rd bit of the
particular number such that other bits are not affected..
if bitnum=10(say.. it can be any no..

Answer Posted / binu

YOU CAN SET OR CLEAR THE THIRD BIT without changing other bits

#define BIT3 (0X01<<3)
void main()
{
int a;
//set the third bit of a
a|=BIT3;
//clear the third bit
a&=~BIT3;

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is use of null pointer in c?

1060


Write a program to print numbers from 1 to 100 without using loop in c?

1138


how to build a exercise findig min number of e heap with list imlemented?

2127


Explain what are run-time errors?

1145


Explain what are the standard predefined macros?

1170


What is the difference between local variable and global variable in c?

1293


What is the use of ?: Operator?

1188


What does s c mean in text?

1149


What is const volatile variable in c?

1105


What is getch?

1277


What is the size of structure pointer in c?

1122


write a c program to find the sum of five entered numbers using an array named number

2207


Why do we use int main instead of void main in c?

1204


What is scope rule of function in c?

1151


What is declaration and definition in c?

1178