用C語言實現兩個值交換的四種方法

四種用C語言實現交換兩個數的方法 :code 方法一:藉助第三個變量,以實現兩個數的交換。 io #include<stdio.h> int main() { int a,b,temp; scanf("%d %d",&a,&b); printf("交換前:a=%d , b=%d\n",a,b); temp = a; a = b; b = temp; printf("交換後:a=%d
相關文章
相關標籤/搜索