#include<stdio.h>
int main()
{
int a,b,c;
c=0;
printf("請輸入兩個數字\n");
scanf("%d %d",&a,&b);
c=b;
b=a;
a=c;
printf("%d %d",a,b);
return 0;
}//存在中間變量進行兩個數交換
#include<stdio.h>
int main()
{
int a,b;
printf("請輸入兩個數字“);
scanf("%d %d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("%d %d,a,b);
return 0;
}//沒有中間變量進行兩數交換
```c
在這裏插入代碼片
初學c語言【2】用和不用中間參量進行兩個數交換
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.