Develop a program to swap two numbers using pointer and add swaped numbers also print their addition.
#include<stdio.h>
void swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
void main()
{
int x,y,sum;
printf("\n Enter value for x:");
scanf("%d",&x);
printf("\n Enter value for y:");
scanf("%d",&y);
swap(&x,&y);
printf("\nx=%d",x);
printf("\ny=%d",y);
sum=x+y;
printf("Sum of x+y = %d",sum);
}