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

Tell us the use of fflush() function in c language?

1146


how to execute a program using if else condition and the output should enter number and the number is odd only...

2303


In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]

2483


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

1310


What is the difference between formatted&unformatted i/o functions?

1060


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

1102


List some of the dynamic data structures in C?

1248


What does the function toupper() do?

1132


What is calloc() function?

1103


How do you generate random numbers in C?

1201


Explain what is the purpose of "extern" keyword in a function declaration?

1073


Sir i need notes for structure,functions,pointers in c language can you help me please

2419


How many bytes is a struct in c?

1170


Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

1022


There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?

1306