C PROGRAMMING

write a c program to swap two variables using function

#include<stdio.h>
#include<conio.h>
swap(int x, int y)
{
int z;
z=x;
x=y;
y=z;
printf("values after swappingn");
printf("%d %d n",x,y);
}

main()
{
int a;
int b;
printf("Enter first numbern");
scanf("%d",&a);
printf("Enter second numbern");
scanf("%d",&b);
printf("values before swappingn");
printf("%d %d n",a,b);
swap(a,b);
getch();
}

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button