PROGRAM TO SHOW CONCEPT OF SWAPPING USING FUNCTION

Programming Languages

/* PROGRAM TO SHOW CONCEPT OF SWAPPING USING FUNCTION */

#include<stdio.h>
#include<conio.h>

void swap(int a,int b);
void main()
{
int a,b;
clrscr();
printf(“ENTER THE VALUE OF A :”);
scanf(“%d”,&a);
printf(“ENTER THE VALUE OF B :”);
scanf(“%d”,&b);
swap(a,b);
getch();
}
void swap(int x,int y)
{
int temp;
temp=x;
x=y;
y=temp;
printf(“\nAFTER SWAPPING\n”);
printf(“\nA :%d “,x);
printf(“\nB :%d “,y);
}

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.