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
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
What is use of bit field?
what is stack , heap ,code segment,and data segment
What is the scope of static variable in c?
Hai what is the different types of versions and their differences
What is the use of f in c?
What is scope rule in c?
Are pointers really faster than arrays?
What is meant by type casting?
Ow can I insert or delete a line (or record) in the middle of a file?
write a c program to find the sum of five entered numbers using an array named number
Explain enumerated types in c language?
Define macros.
write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?
What does sizeof function do?