C Program to Interchanging Two Numbers

How to write a C Program to Interchanging Two Numbers in C Programming Language ?


Solution:
This program interchanges the two numbers in putted from the keyboard.

Two numbers are input through the keyboard into two locations C and D.

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

  1. #include<stdio.h>
  2. main ()
  3.  
  4. {
  5. int A,C,D;
  6. printf ("Enter the value of C and D: ");
  7.  
  8. scanf ("%d %d", &C, &D);
  9.  
  10. A=C;
  11.  
  12. C=D;
  13. D=A;
  14.  
  15. printf ("\nThe exchanged values of C and D are: %d and %d ", C, D);
  16.  
  17. }


Learn More :