Swapping Values of variables in C Programming
This is really a easy code for swapping values of variables.Try to understand the logic. We have to take another extra integer (temp).
Logic : Stored the value of “b” in “temp”. Then stored the value of “a” in “b”.Then “c” in “a”.
Finally takeback the value of “b” from “temp” in “c”.
Here is the Code:
printf(“Enter Value of A, B and C Respectively Using Space : “);
printf(“Value After Swapping Numbers :\n”);
printf(” A= %d \n B= %d \n C= %d \n “,a,b,c);