详情源码:
#include <stdio.h>
void main()
{
int x,y,z;
printf("intput two numbers:
");
scanf("%d%d", &x,&y); /*input the number that need exchange*/
printf("x==%d y==%d
", x,y); /*ouput the number before exchange*/
z = x;
x = y;
y = z;
printf("exchange over!
"); /*exchange over*/
printf("x==%d y==%d
", x, y); /*output the result*/
getch();
}
运行结果:
流程图: