Qualcomm Interview Question

Write a code for swapping