How many ways are there to swap two numbers without using
temporary variable? Give the each logic.
Answer Posted / kishan gowda
One more method its bit complicated from the people from
the non electronics background......
void main()
{
pf(" a and b ");
sf("%d %d", &a, &b);
a= a^b;
b= b^a;
a= a^b;
pf("Swapped no's are a=%d and b=%d" ,a ,b);
}
| Is This Answer Correct ? | 24 Yes | 4 No |
Post New Answer View All Answers
How does struct work in c?
How will you divide two numbers in a MACRO?
What’s a signal? Explain what do I use signals for?
What are the types of operators in c?
What is enumerated data type in c?
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
How do you determine the length of a string value that was stored in a variable?
What is openmp in c?
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
how to print the character with maximum occurence and print that number of occurence too in a string given ?
What is s in c?
What is the total generic pointer type?
What is the use of getchar() function?
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
Why c is a mother language?