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
How are Structure passing and returning implemented by the complier?
Can you write a programmer for FACTORIAL using recursion?
How can I find the modification date of a file?
What should malloc(0) do?
What is difference between structure and union in c?
What is the sizeof () operator?
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above
What is pointer in c?
Where we use clrscr in c?
I need testPalindrome and removeSpace
#include
What is the difference between mpi and openmp?
Can stdout be forced to print somewhere other than the screen?
What is page thrashing?
When should structures be passed by values or by references?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;