야근안하기 위한 개린이 블로그

[1일1알고리즘] 5일차 A Very Big Sum 본문

개발/1일1알고리즘

[1일1알고리즘] 5일차 A Very Big Sum

벨린이 2020. 4. 13. 09:00

[1일1알고리즘] 5일차 A Very Big Sum

배열에있는 요소의 정수 합계를 출력.

Sample Input
5
1000000001 1000000002 1000000003 1000000004 1000000005
Output
5000000015
<?php

// Complete the aVeryBigSum function below.
function aVeryBigSum($ar) {
    $total=0;
    for($i=0; $i<count($ar); $i++) {
        $total += $ar[$i];
    }
    return $total;

}
Comments