#include <stdio.h>
int main()
{
// 4. Write a C program to interchange two numbers
printf("\tInterchange Two Numbers");
printf("\n===============================================");
int a, b, c;
printf("\n\nEnter A : ");
scanf("%d", &a);
printf("\nEnter B : ");
scanf("%d", &b);
printf("\n_______________________________________________");
printf("\n\nBefore Interchange A=%d and B=%d ", a, b);
c = a;
a = b;
b = c;
printf("\n\nAfter Interchange A=%d and B=%d ", a, b);
printf("\n_______________________________________________\n\n");
return 0;
}
This code prompts the user to enter two integer values, then it swaps the values of the variables storing the two integers, and then it prints the values of the variables before and after the interchange. The purpose of the program is to demonstrate how to interchange the values of two variables in C.