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.
- #include<stdio.h>
- main ()
- {
- int A,C,D;
- printf ("Enter the value of C and D: ");
- scanf ("%d %d", &C, &D);
- A=C;
- C=D;
- D=A;
- printf ("\nThe exchanged values of C and D are: %d and %d ", C, D);
- }