write a program to swap Two numbers without using temp variable.
Answer Posted / gaurav sharma
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int a,b;
printf("enter the value of a : ");
scanf("%d",&a);
printf("enter the value of b : ");
scanf("%d",&b);
printf("Before swapping a is %d and b is %d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("\nAfter swapping of a and b:\na=%d\nb=%d",a,b);
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
What is f'n in math?
What is the difference between volatile and const volatile?
What is LINKED LIST? How can you access the last element in a linked list?
Tell us bitwise shift operators?
Differentiate between a for loop and a while loop? What are it uses?
What is the method to save data in stack data structure type?
Explain what does a function declared as pascal do differently?
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
How can I copy just a portion of a string?
What is the use of a semicolon (;) at the end of every program statement?
What are header files and what are its uses in C programming?
write a c program for swapping two strings using pointer
Can include files be nested?
What does a pointer variable always consist of?