How many ways are there to swap two numbers without using
temporary variable? Give the each logic.
Answer Posted / vignesh1988i
as for i know their are two different logics for the
swapping techinque.... swapping is a type of techinque used
for interchanging the two varibles in the operating
memory....
1) using only variables
2) using EX-OR operator '^'
first logic only know.
void main()
{
int a,b;
printf("enter the a&b");
scanf("%d%d",&a,&b);
a+=b;
b=a-b;
a-=b;
printf("a=%d\nb=%d",a,b);
getch();
}
| Is This Answer Correct ? | 48 Yes | 4 No |
Post New Answer View All Answers
What is the difference between new and malloc functions?
Is a house a shell structure?
Why do we use namespace feature?
What is function what are the types of function?
What is function prototype?
What is chain pointer in c?
What is getch?
What is the scope of an external variable in c?
Why is C language being considered a middle level language?
Why ca not I do something like this?
What is wrong in this statement?
Explain how can I make sure that my program is the only one accessing a file?
Can you return null in c?
What is #include conio h?
What are the different types of endless loops?