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...

Toggle nth bit in a given integer - num

Answer Posted / banavathvishnu

#include<stdio.h>
#include<conio.h>


Togglebit(int k,int bit)
{
printf("after %d bit is toggled = %d",bit,(k^(1<<(bit-
1))));
return 1;

}
int main()
{
int i;
int bitno;
printf("enter the number \n");
scanf("%d",&i);
printf("enter the bit number to toggle \n");
scanf("%d",&bitno);
Togglebit(i,bitno);
getch();


return 1;
}

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how can you tell whether two strings are the same?

971


What is the function of multilevel pointer in c?

1027


What would happen to X in this expression: X += 15; (assuming the value of X is 5)

1883


Is it cc or c in a letter?

960


while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above

1197


What does 3 periods mean in texting?

1012


What are the types of macro formats?

1059


What are the types of variables in c?

979


please can any one suggest me best useful video tutorials on c i am science graduate.please help me.u can email me to sas29@in.com

1722


Explain why can’t constant values be used to define an array’s initial size?

1305


How can I send mail from within a c program?

984


What is #ifdef ? What is its application?

1054


An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array

1089


What are comments and how do you insert it in a C program?

1198


How can I find the modification date and time of a file?

1028