# Swapping of two numbers with third variable in c

There are many methods for swapping two numbers but this is the simplest method for swap the number with the third variable. Beginners can understand this tutorial very easily. We are creating simple Swapping of two numbers with a third variable.

## swapping of two numbers with using third variable in c

Output:-

Enter first number for x :22
Enter second number for y :33
After Swapping the value of x is :33
After Swapping the value of y is :22

## Explanation of Program :

In this program, three variables are created here x,y and z. The value initialized into only two variables x & y.

We can understand by given below pattern.

x=10 and target is x=20

y=20 y=10

**z = x** x value copy into z is **10 **

**x = y ** y value copy into x is **20**

**y = z** z value copy into y is **10**

Â© 2016-2019, Codeverb.com - All Rights Reserved