카타 8급 Sum Arrays

1 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;
}

2 PHP[ | ]

function sum(array $a): float {
  return array_sum($a);
}

3 R[ | ]

sum_array <- function(a){
  sum(a)
}
sum_array <- sum
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}