Swap value of two variables in c programming
In this post we will show you how to A Swap value of two variables in c programming. flowing code will help you to perform program.
// include header file # include <stdio.h> # include <conio.h> // main function void main() { int a,b,temp; clrscr(); printf("Enter A: "); scanf("%d",&a); printf("Enter B: "); scanf("%d",&b); printf("\nBefore Swap:"); printf("\nValue of A is: %d",a); printf("\nValue of B is: %d",b); // Swamping value of a and b temp=a; a=b; b=temp; // print result printf("\n\nAfter Swap:"); printf("\nValue of A is: %d",a); printf("\nValue of B is: %d",b); getch(); }