write a program to swap Two numbers without using temp variable.
Answer Posted / yash paranjape
a=a^b;
b=a^b;
a=a^b;
i.e
a^=b;
b^=a;
a^=b;
more simplifie i.e in just one line
a^=b^=a^=b;
This also works fine
Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Is c# a good language?
Are c and c++ the same?
7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.
What are the features of the c language?
How to write a multi-statement macro?
Why c is a procedural language?
design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.
What are directives in c?
What are the different types of control structures?
Explain how can I pad a string to a known length?
Why C language is a procedural language?
What is a sequential access file?
What is operator precedence?
Describe the header file and its usage in c programming?
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me