luc009.c (663B)
1 /* Two numbers are input through the keyboard into two locations 2 C and D. Write a program to interchange the contents of C and D. */ 3 /* Let Us C, Chap - 2, Page - 37, Qn No.: G(d) */ 4 5 #include <stdio.h> 6 int main() 7 { 8 double a, b; 9 printf("Enter the two number A and B : "); 10 scanf("%lf %lf", &a, &b); 11 printf("\nBefore Interchange : "); 12 printf("\nA = %g (Memory location = %p)", a, &a); 13 printf("\nB = %g (Memory location = %p)", b, &b); 14 a = a + b; 15 b = a - b; 16 a = a - b; 17 printf("\nAfter Interchange :"); 18 printf("\nA = %g (Memory location = %p)", a, &a); 19 printf("\nB = %g (Memory location = %p)", b, &b); 20 return 0; 21 }