Saturday, January 30, 2010

CHAP 1[H]f Interchanging values

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

void main()
{
float c,d,e,f;
printf("\nInput values of C and D");
scanf("%f%f",&c,&d);
e=c;
f=d;
c=f;
d=e;
printf("\nNow C is %f\nD is %f",c,d);
}

No comments:

Post a Comment