Page

source code for swapping two values using third variable in c language

#include <stdio.h>
#include <conio.h>
void main()
{
int a, b, temp;
printf("Enter the value of a\n");
scanf("%d",&a);
printf("Enter the value of b\n");
scanf("%d",&b);
printf("Before Swapping\na = %d\nb = %d\n",a,b);
temp = a;
a    = b;
b    = temp;
printf("After Swapping\na = %d\nb = %d\n",a,b);
getch();
}

No comments:

Post a Comment