write a program to swap Two numbers without using temp variable.
Answer Posted / romeld
#include<stdio.h>
main()
{
int a,b;
printf("enter the value of a and b\n");
scanf("%d%d",&a,&b);
printf("before swapping\na=%d\nb=%d\n",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("after swapping\na=%d\nb=%d\n",a,b);
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How do you generate random numbers in C?
What are comments and how do you insert it in a C program?
What is realloc in c?
Write a program to reverse a string.
What is the difference between if else and switchstatement
What is extern keyword in c?
Why does notstrcat(string, "!");Work?
When should the volatile modifier be used?
In C language, a variable name cannot contain?
What does the c in ctime mean?
How can I find the modification date of a file?
Why n++ execute faster than n+1 ?
What is the difference between ++a and a++?
Explain how can I read and write comma-delimited text?
What do you mean by a sequential access file?