In this program, You will learn how to swap two numbers without using third variable in R.

```
Before swap : x = 10, y = 20
x = x + y
y = x - y
x = x - y
After swap : x = 20, y = 10
```

## Example: How to swap two numbers without using third variable in R

```
{
x <- as.integer(readline(prompt = "Enter x value :"))
y <- as.integer(readline(prompt = "Enter y value :"))
x = x + y
y = x - y
x = x - y
print(paste("After swap x is :", x))
print(paste("After swap y is :", y))
}
```

#### Output:

```
Enter x value :34
Enter y value :30
[1] "After swap x is : 30"
[1] "After swap y is : 34"
```