coding_test/BAEKJOON
백준 15596번 C언어 풀이
CodeJin
2021. 8. 5. 20:35
https://www.acmicpc.net/problem/15596
15596번: 정수 N개의 합
C++17, Java 8, Python 3, C11, PyPy3, C99, C++98, C++11, C++14, Python 2, PyPy2, Go, C99 (Clang), C++98 (Clang), C++11 (Clang), C++14 (Clang), C11 (Clang), C++17 (Clang)
www.acmicpc.net
N개의 정수의 합을 구하는 함수를 구현하는 문제. 주어진 함수의 조건들을 충족하면 된다.
#include<stdio.h>
long long sum(int *a, int n){
long long total = 0;
for (int i=0; i<n; i++) {
total += a[i];
}
return total;
}