How many ways are there to swap two numbers without using
temporary variable? Give the each logic.
Answer Posted / gana samantula
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf(" Enter the first No.:");
scanf("%d",&a);
printf(" Enter the second No.:");
scanf("%d",&b);
b=a+b-(a=b);
printf(" the swap of a and b numbers :%d %d",a,b);
getch();
}
| Is This Answer Correct ? | 14 Yes | 0 No |
Post New Answer View All Answers
What is the purpose of void pointer?
Explain what is meant by 'bit masking'?
What is the size of empty structure in c?
What is the difference between declaring a variable and defining a variable?
Differentiate between null and void pointers.
What are types of structure?
How important is structure in life?
Explain about C function prototype?
What is dynamic memory allocation?
Write program to remove duplicate in an array?
diff between exptected result and requirement?
What is a substring in c?
can we have joblib in a proc ?
Explain how can you check to see whether a symbol is defined?
What are the different types of linkage exist in c?