You can also swap two numbers without using third variable. In that case C program will be as follows:
Output of program:
To understand the logic choose the variables 'a' and 'b' as '7' and '9' respectively and then do what is being done by the program. You can choose any other combination of numbers as well. Sometimes it's an excellent way to understand a program.