> For the complete documentation index, see [llms.txt](https://mun.gitbook.io/c/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mun.gitbook.io/c/solution/2-operator/2.1-assignment-operator.md).

# 2.1 Assignment Operator

## ২.১ অ্যাসাইনমেন্ট অপারেটর (১)

1. \[1] দুইটি ভ্যারিয়েবল এর মান পরস্পর স্থান পরিবর্তন কর। ({a=1, b=2} -> {a=2, b=1})

## সমাধান

### \[1] দুইটি ভ্যারিয়েবল এর মান পরস্পর স্থান পরিবর্তন কর। ({a=1, b=2} -> {a=2, b=1}) <a href="#id-1" id="id-1"></a>

{% code lineNumbers="true" %}

```c
#include<stdio.h>
int main(){
    int a, b, temp;
    
    scanf("%d%d". &a, &b);

    printf("Before Swap: a = %d, b = %d\n", a, b);

    temp = a;
    a = b;
    b = temp;

    printf("After Swap: a = %d, b = %d\n", a, b);

    return 0;
}
```

{% endcode %}

| Sample Input | Sample Output                                                   |
| ------------ | --------------------------------------------------------------- |
| 1 2          | <p>Before Swap: a = 1, b = 2</p><p>After Swap: a = 2, b = 1</p> |
| 2 4          | <p>Before Swap: a = 2, b = 4</p><p>After Swap: a = 4, b = 2</p> |
