下列程式碼執行後輸出結果為何?- int a[9] = {1, 3, 5, 7, 9, 8, 6, 4, 2};
- int n=9, tmp;
- for (int i=0; i<n; i=i+1)
- {
- tmp = a[i];
- a[i] = a[n-i-1];
- a[n-i-1] = tmp;
- }
- for (int i=0; i<=n/2; i=i+1)
- printf ("%d %d ", a[i], a[n-i-1]);
複製代碼 (A) 2 4 6 8 9 7 5 3 1 9
(B) 1 3 5 7 9 2 4 6 8 9
(C) 1 2 3 4 5 6 7 8 9 9
(D) 2 4 6 8 5 1 3 7 9 9
本帖隱藏的內容需要回復才可以瀏覽 |