Toggle nth bit in a given integer - num

Answer Posted / sahil

num=num ^ (1<<(n-1));

Is This Answer Correct ?    51 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is const and volatile in c?

561


How does free() know explain how much memory to release?

616


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

3139


What are header files in c programming?

653


What is the difference between exit() and _exit() function?

599






void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1255


What are header files? What are their uses?

634


Is there any possibility to create customized header file with c programming language?

620


formula to convert 2500mmh2o into m3/hr

493


Are c and c++ the same?

624


How to draw the flowchart for structure programs?

8760


What is "Hungarian Notation"?

635


what is bit rate & baud rate? plz give wave forms

1512


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

1642


Explain what is the difference between functions abs() and fabs()?

614