Swap Two variable value using Third variable – C Program

Swap Two variable value using Third variable – C Program

write a c program to swap(interchange) value of two variable using third variable.

#include<stdio.h>
#include<coino.h>

void main()
{
 int a, b, c;

 printf("Enter the First Vaue A = ");
 scanf("%d",&a);
 printf("\nEnter thr Second Value B = ");
 scanf("%d",&b);
 c=a;
 a=b;
 b=c;
 printf("The value of A = %d",a);
 printf("\nThe value of B =%d",b);

getch();
}

The swap variable value using third variable c program output is :

Enter the First Vaue A = 25

Enter thr Second Value B = 102

The value of A = 102
The value of B = 25

 

Leave a Reply

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