Sum an array · Tổng mảng
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · Trang này cần trình duyệt gần đây (hỗ trợ SharedArrayBuffer). Vui lòng cập nhật Chrome, Edge, Firefox hoặc Safari lên phiên bản mới nhất.
English
Sum an array
Add the n integers that a points to. A pointer like const int *a works just like an array — a[i] is the i-th element.
Tiếng Việt
Tính tổng mảng
Cộng các n phần tử mà a trỏ tới. Một con trỏ như const int *a hoạt động giống hệt mảng — a[i] là phần tử thứ i.
Complete int sum_array(const int *a, int n) to return the sum of the n elements. Do not write main — the checker provides one. · Hoàn thành int sum_array(const int *a, int n) để trả về tổng của n phần tử. Không viết main — bộ kiểm tra sẽ cung cấp một.
Click Run to see the output here. · Nhấn Chạy để xem kết quả ở đây.