Pages

Friday, December 16, 2011

Program to interchange two values

This program interchanges two values input through 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>
void main()
{
int C,D,temp;
clrscr();
printf("Enter value of C and D :");
scanf("%d %d",&C,&D);
temp=C;
C=D;
D=temp;
printf("\nThe interchanged value of C and D are %d %d",C,D);
getch();

}

No comments: