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
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
What is wrong with this initialization?
Which one to choose from 'initialization lists' or 'assignment', for the use in the constructor?
How to explain the final year project as a fresher please answer with sample project
What is static memory allocation?
Here is a good puzzle: how do you write a program which produces its own source code as output?
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
What is the symbol indicated the c-preprocessor?
Can we change the value of static variable in c?
Explain what are reserved words?
How many header files are in c?
What is the difference between struct and union in C?
Why #include is used in c language?
What is the explanation for cyclic nature of data types in c?
What is sizeof array?