Write a C program to interchange the contents of C and D

Problem Statement :
Two numbers are input through the keyboard into two locations C and D. Write a program to interchange the contents of C and D.
Answer:
 /* Interchanging of contents of two variables c & d */
#include<stdio.h>
 #include<conio.h>
main()
 {
int c,d,e;
clrscr();
 printf(“\n Enter the number at location C:”);
 scanf(“%d”, &c);
printf(“\n Enter the number at location D:”);
 scanf(“%d”, &d);
/*Now interchange the contents of two variables using a third variable as temp store */
e=c;
 c=d;
 d=e;
printf(“\n New Number at location C=%d”,c);
 printf(“\n New Number at location D=%d”,d);
printf(“\n\n\n\n\n Press any key to exit….”);
 getch();
}

