카타 8급 Sum Arrays

Jmnote bot (토론 | 기여)님의 2019년 2월 3일 (일) 04:03 판 (봇: 자동으로 텍스트 교체 (-분류:PHP +))

1 개요

카타 8급 C
# 🔗 문제 풀이

틀:카타 8급-4

2 C

#include <stddef.h>
int sum_array(const int *values, size_t count) {
  int sum = 0;
  for(int i=0; i<count; i++) sum += values[i];
  return sum;
}
#include <stddef.h>
int sum_array(const int *values, size_t count) {
  int sum = 0;
  while(count--) sum+=values[count];
  return sum;
}

3 PHP

function sum(array $a): float {
  return array_sum($a);
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}