Radical Developers welcomes all the visitors to be a member of the team. Come join us. Its all about open-source concept. All Programs are written and tested in MacOS X, Unix, Linux and may not match with the outputs of Turbo C++ in Windows

Sunday, January 9, 2011

Two Numbers are input through the keyboard into two locations C & D. Write a program to interchange the contents of C & D.

Source Code :

#include<stdio.h>
void main()
{
      int c,d;
      clrscr();
      printf("\nEnter Two Numbers : ");
      scanf("%d%d",&c,&d);
      c=c+d;
      d=c-d;
      c=c-d;
      printf("\nInterchanged Numbers : %d,%d",c,d);
      getch();
}

Output :

Enter Two Numbers : 5 7

Interchanged Numbers : 7,5

No comments:

Post a Comment